Click Default Group
DefaultGroup is a sub class of click.Group. But it invokes a default
subcommand instead of showing a help message when a subcommand is not passed.
Usage
Define a default subcommand by default=NAME:
import click
from click_default_group import DefaultGroup
@click.group(cls=DefaultGroup, default='foo', default_if_no_args=True)
def cli():
pass
@cli.command()
def foo():
click.echo('foo')
@cli.command()
def bar():
click.echo('bar')
Then you can invoke that without explicit subcommand name:
$ 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
Compatibility
click-default-group is compatible with these Click versions:
- Click-7.0
- Click-6.x
- Click-5.1
- Click-5.0
- Click-4.1
- Click-4.0
See the latest build status at Travis CI.
Licensing
Written by Heungsub Lee, and distributed under the BSD 3-Clause license.
Release files for click-default-group 1.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| click_default_group-1.2.4.tar.gz | 3.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| click_default_group-1.2.4-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 7.6 kB
Release files / click_default_group-1.2.4.tar.gz
| Download URL | click_default_group-1.2.4.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eb3f3c99ec0d456ca6cd2a7f08f7d4e91771bef51b01bdd9580cc6450fe1251e
|
|
BLAKE2b-256 checksum How to use checksums |
1dceedb087fb53de63dad3b36408ca30368f438738098e668b78c87f93cd41df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / click_default_group-1.2.4-py2.py3-none-any.whl
| Download URL | click_default_group-1.2.4-py2.py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
9b60486923720e7fc61731bdb32b617039aba820e22e1c88766b1125592eaa5f
|
|
BLAKE2b-256 checksum How to use checksums |
2c1aaff8bb287a4b1400f69e09a53bd65de96aa5cee5691925b38731c67fc695
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|