-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Milestone
Description
When a group is created with multiple commands, but the script is called without any commands, the exit code is 0. It looks like this line just needs to be changed to have an exit code. But it's not clear if ctx.fail()
should be used instead.
Example Code
import click
@click.group()
def cli():
print("in group")
@cli.command()
def foo():
print("foo")
@cli.command()
def bar():
print("bar")
if __name__ == "__main__":
print("before group")
cli()
Expected Behavior
A non-zero exit code.
Actual Behavior
$ python click_poc.py
before group
Usage: click_poc.py [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
bar
foo
$ echo $?
0
Environment
- Python version: Python 3.8.0
- Click version: Click==7.0
tadeuszkleszcz
Metadata
Metadata
Assignees
Labels
No labels