Skip to content

Commit 966267a

Browse files
committed
docs: make subcommands organization example be more explicit
1 parent 61968e8 commit 966267a

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

site/content/user_guide.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,20 +196,22 @@ subcommands. For example, consider the following directory structure:
196196
```console
197197
├── cmd
198198
│   ├── root.go
199+
│   ├── leafA.go
199200
│   └── sub1
200201
│   ├── sub1.go
201202
│   └── sub2
202-
│   ├── leafA.go
203203
│   ├── leafB.go
204+
│   ├── leafC.go
204205
│   └── sub2.go
205206
└── main.go
206207
```
207208

208209
In this case:
209210

210-
* The `init` function of `root.go` adds the command defined in `sub1.go` to the root command.
211+
* The `init` function of `root.go` adds the command defined in `leafA.go` and `sub1.go` to the
212+
root command.
211213
* The `init` function of `sub1.go` adds the command defined in `sub2.go` to the sub1 command.
212-
* The `init` function of `sub2.go` adds the commands defined in `leafA.go` and `leafB.go` to the
214+
* The `init` function of `sub2.go` adds the commands defined in `leafB.go` and `leafC.go` to the
213215
sub2 command.
214216

215217
This approach ensures the subcommands are always included at compile time while avoiding cyclic

0 commit comments

Comments
 (0)