Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to control ordering/grouping of commands in help text #149

Open
vito opened this issue Oct 26, 2015 · 2 comments · May be fixed by #238
Open

Ability to control ordering/grouping of commands in help text #149

vito opened this issue Oct 26, 2015 · 2 comments · May be fixed by #238

Comments

@vito
Copy link
Contributor

vito commented Oct 26, 2015

My CLI has a few commands that I'd like to call out for easier discoverability, e.g. login should be listed first. Currently commands are ordered alphabetically, which is a sane default especially when the AddCommand flow is used (since the order is not well-defined with func init()).

Some way to influence the ordering, or even better, having a way to group commands together (similar to option groups) would be nice. For example, in large CLIs you'll often have a set of commands relevant to a particular object type.

@vito
Copy link
Contributor Author

vito commented Oct 27, 2015

Here's an example that would be helped by this kind of thing:

https://github.com/concourse/fly/blob/20980dc/commands/fly.go

Note that there's semantic grouping in the struct itself (which I'd happily group further if the group struct tags applied), which gets lost in the help text.

@jessevdk
Copy link
Owner

I think allowing to place commands in groups would work pretty well. This requires some reorganization, but should be doable.

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

Successfully merging a pull request may close this issue.

2 participants