-
Notifications
You must be signed in to change notification settings - Fork 35
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
Enable help for positional arguments #11
Comments
@ewels If you are looking to add help for arguments, you can use Cloup: https://cloup.readthedocs.io/en/stable/pages/arguments.html |
Nice, thanks for the tip! That's a good solution. Any idea how the output looks? If it works with rich-click already then I can just add a note in the readme.. |
No idea how it looks like with |
@kdeldycke did you manage to make cloup and rich-click work together? |
@wabiloo I know this isn't quite what you'd want, but you can use import rich_click as click
@click.command()
@click.argument("name")
@click.option("--count", default=1, help="Number of greetings.")
@click.rich_config(help_config={"show_arguments": True})
def hello(name, count):
"""Simple program that greets NAME for a total of COUNT times."""
for _ in range(count):
click.echo(f"Hello, {name}!")
if __name__ == '__main__':
hello() Still can't put help text in, but it is probably better than nothing if you want this. Note: I do not intend on working on this feature myself for the foreseeable future, but just for lack of wanting to bother. I'm all for the feature existing as an option for users. Basically, I would accept a PR that wraps |
No, I did not try. But I feel like by the time I'll play with |
Click deliberately does not support
help
for positional arguments.I think it would be good to support this if people want, it is a bit more relevant with the rich-click tabular output.
To make this work, we need to enable an additional argument for the
click.argument()
function though, which is a little involved. Others have asked for this feature and some have done their own implementations, see pallets/click#587 (comment)Should be able to recreate something like this in
rich-click
to add support for argumenthelp
.The text was updated successfully, but these errors were encountered: