-
Notifications
You must be signed in to change notification settings - Fork 41
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
Allow typing "help" instead of ":help" #9
Comments
:help is guaranteed not to clash with the app's subcommands, and it's probably a matter of preference whether to show the REPL or the Click help text on |
Thanks! Can you please give me a pointer on how to write this help command? I looked at the click source code but didn't find an obvious answer. |
I mean it'd be just a normal subcommand, also available via the normal CLI. I just realized that might be a problem, so this might be an insufficient solution. On 31 July 2016 17:00:16 CEST, Ram Rachum notifications@github.com wrote:
Sent from my Android device with K-9 Mail. Please excuse my brevity. |
Cool, I reopened this issue. Do you agree it should be an option to |
This seems to work: import click
import click_repl
@click.group()
def cli():
pass
@cli.command()
def test():
pass
@cli.command()
@click.pass_context
def repl(ctx):
@cli.command()
@click.pass_context
def help(ctx):
click.echo(ctx.parent.parent.get_help())
ctx.exit()
try:
click_repl.repl(ctx)
finally:
del cli.commands['help']
cli() Quite a hack. Still unsure though if I want anything like that in click-repl though. |
Thanks for the code sample. I believe I won't use that because it looks too hacky to me. Thanks anyway. |
I solved this by simply doing the following:
|
How are users supposed to figure out that they should type
:help
rather thanhelp
? Go to the click-repl GitHub page and read about it? I'm preparing a script for people who don't care about my script, don't care about click and definitely don't care about click-repl. I want to make the most obvious thing work for them.The text was updated successfully, but these errors were encountered: