Attempt to run test program (shown later below) results in error:
$ python -m test test2 --all
test #2 True
Usage: main.py [OPTIONS]
Try "main.py --help" for help.
Error: no such option: --all
However, running test program with click "--help" option clearly shows that "-all" is an available option on the test2 command.
$ python -m test test2 --help
Usage: main.py test2 [OPTIONS]
Options:
--all
--help Show this message and exit.
import click
@click.group()
def cli():
pass
@cli.command()
def test1():
print("test #1")
@cli.command()
@click.option("--all", is_flag=True)
def test2(all):
print("test #2", all)
if all:
test1()
if __name__ == '__main__':
cli()