Skip to content

Unexpected behavior of no_args_is_help with 0 or 1 commands #937

Discussion options

You must be logged in to vote

Thanks for the report!

Let's think about each case individually.

2 commands

So, the case with 2 commands is working as expected, right?

1 command

For the case of one command, it's currently working as intended, at least that's how it was designed from the beginning. When there's an app with a single command, that command is called directly, there's no subcommand created for it. It's documented here: https://typer.tiangolo.com/tutorial/commands/#explicit-application

If you want it to be a subcommand you would need to do one of:

  • Add another command (which you wouldn't want in this case)
  • Add a callback, it can be just a no-op, but it would tell Typer that this app should be considered a "gr…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by tiangolo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem
3 participants
Converted from issue

This discussion was converted from issue #450 on August 18, 2024 22:48.