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

Main help should give a hint on how to show subcommand help #291

Open
ziggystar opened this issue May 14, 2021 · 1 comment
Open

Main help should give a hint on how to show subcommand help #291

ziggystar opened this issue May 14, 2021 · 1 comment

Comments

@ziggystar
Copy link

ziggystar commented May 14, 2021

I've experienced, that it can sometimes be difficult to get to the subcommand help text.

Currently you have to type <subcommand> --help. This is not mentioned on the main help page. Some people might stop here.
Some other people might even try --help <subcommand> and then stop.

I think it is a good idea to add some little text to the main help page to explain how to get to subcommand help.

Now thinking about it, maybe it's not always possible to do <subcommand> --help, depending on whether the subcommand allows help. Is this correct?

Then it might be needed to support --help <subcommand> and note this within the main help page.

What do you think? I might make a pull request if we agree on something. I love this library.

@bkirwi
Copy link
Owner

bkirwi commented Apr 23, 2022

Looks like I missed this one when it was originally posted; apologies!

I've experienced, that it can sometimes be difficult to get to the subcommand help text.

Fair!

Now thinking about it, maybe it's not always possible to do --help, depending on whether the subcommand allows help. Is this correct?

It is! (Perhaps unfortunately -- I wanted to do the usual thing by default, and allow users to do something custom if they wished; flexible, but has this downside.)

Then it might be needed to support --help and note this within the main help page.

Normally we're very hesitant to innovate on syntax, and I'm not aware of any other CLI tools that do this.

However! It is very common to have a help subcommand, which with zero arguments behaves like --help or with one argument behaves like <subcommand> --help. It sounds like this would satisfy the same goals in a more standard way.

It's possible to add such a subcommand to your app now, though a bit hacky. Unfortunately it's a bit more awkward to support at the library level --- it involves piping Help objects around in the parser in a way that's not done currently --- but definitely possible with some refactoring in the core.

If anyone's interested in doing that work --- or it's not clear how to do the hacky version in your own app --- happy to discuss more here.

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

No branches or pull requests

2 participants