Skip to content

Conversation

@lvjp
Copy link

@lvjp lvjp commented Jan 13, 2026

It's always difficult to be sure that we understand the subcommands organization if we cannot match the example.
In the real world we are facing a lot of time leaf and subcommand at the same level. Just put it into the example.

If we take the well-known Docker command (simplified) as an example:

├── ps
└── container
    ├── kill
    ├── ls
    └── logs

Should I put ps into cmd/ps.go beside root.go or into cmd/ps/ps.go ?

I think that the documentation is for having cmd/ps.go :

The suggested approach is for the parent command to use AddCommand to add its most immediate subcommands.

But an example is better than words!

@CLAassistant
Copy link

CLAassistant commented Jan 13, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants