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

Auto-generated help command does not appear in docstring #94

Open
JacekLach opened this issue Nov 2, 2015 · 1 comment
Open

Auto-generated help command does not appear in docstring #94

JacekLach opened this issue Nov 2, 2015 · 1 comment

Comments

@JacekLach
Copy link

Thus, to know that program help <subcommand> will do anything I need to know that argh does something like this and that the tool being invoked uses argh.

help should generate the same kind of subcommand output in the short help that other subcommands do (perhaps with an usage string like help - get detailed help for a subcommand.

Workaround:

def help(subcommand):
     "Get detailed help for a subcommand"
     pass

dispatch_commands([..., help])
@neithere
Copy link
Owner

neithere commented Nov 3, 2015

This makes sense.

Note that ./app.py help import xml also works but ./app.py import help xml doesn't.

Current implementation: actually there's no command help, it's always just a very simple top-level alias to ./app.py import xml --help. See https://github.com/neithere/argh/blob/master/argh/dispatching.py#L138

It works but it's not extensible. Fiddling with HelpFormatter is not a good idea because only its name is considered public API (see the argparse code).

We may be able to do it by adding a _HelpAction or a similar object to the parser. However, I'm not sure how exactly it should be done.

The autogenerated usage message should probably look like this:

usage: prog [-h] [help] {foo,bar} ...

...but how to put that [help] at that place, not after mandatory args?

Gotta try some time later, I guess.

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