-
-
Notifications
You must be signed in to change notification settings - Fork 770
🐛 Fix the output for no_args_is_help=True
with Click 8.2
#1262
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
Conversation
Since typer 0.16.0, running a CLI with the no_args_is_help feature enabled displays an error block, e.g. for my application: Usage: myapp [OPTIONS] COMMAND [ARGS]... This is the CLI for my app ╭─ Options ─────────────────────────────────────────────────────────╮ │ --verbose -v Use multiple times for more verbosity. │ │ --help Show this message and exit. │ ╰───────────────────────────────────────────────────────────────────╯ ╭─ Commands ────────────────────────────────────────────────────────╮ │ version Show application version. │ │ run Start the application. │ ╰───────────────────────────────────────────────────────────────────╯ Usage: authsync [OPTIONS] COMMAND [ARGS]... Try 'authsync --help' for help. ╭─ Error ───────────────────────────────────────────────────────────╮ │ │ ╰───────────────────────────────────────────────────────────────────╯ The patch from the PR suppresses the duplicate Usage: info and the Error output block, in case the processed exception is a NoArgsIsHelperror.
+1 (as in, I'm seeing the same issue using Typer v0.16.0) |
+1 (the same issue here) |
no_args_is_help=True
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
thanks for the report!
I can confirm the issue in an environment with Click 8.2.
However, we need to support also earlier versions of 8.0 and 8.1, and NoArgsIsHelpError
has only been introduced in Click 8.2. So we can't have this direct import and we'll need to search for another (and hopefully elegant) way to resolve this bug instead.
no_args_is_help=True
no_args_is_help=True
with Click 8.2
Note that in the meantime, you can avoid this bug by restricting Click to < 8.2. |
@mmakaay: thanks again for your work on this! I'm closing this PR in favour of #1278 which has a unit test, some additional explanations and a different fix with a more narrow scope (in I'd appreciate your review on this new PR if you have time! [edit: it's already merged in the meantime 🙈] |
Since typer 0.16.0, running a CLI with the no_args_is_help feature enabled displays an error block. The patch from the PR suppresses the duplicate
Usage:
info and theError
output block, in case the processed exception is a NoArgsIsHelperror.Example with invalid output (based on the
no_args_is_help
example code)Output with this patch applied: