click_default_group
~~~~~~~~~~~~~~~~~~~
Define a default subcommand by `default=True`:
.. sourcecode:: python
import click
from click_default_group import DefaultGroup
@click.group(cls=DefaultGroup, default_if_no_args=True)
def cli():
pass
@cli.command(default=True)
def foo():
click.echo('foo')
@cli.command()
def bar():
click.echo('bar')
Then you can invoke that without explicit subcommand name:
.. sourcecode:: console
$ cli.py --help
Usage: cli.py [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Command:
foo*
bar
$ cli.py
foo
$ cli.py foo
foo
$ cli.py bar
bar