Skip to main content

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.

Build Status Coverage Status

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

click_default_group-1.2.4.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

click_default_group-1.2.4-py2.py3-none-any.whl (4.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file click_default_group-1.2.4.tar.gz.

File metadata

  • Download URL: click_default_group-1.2.4.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for click_default_group-1.2.4.tar.gz
Algorithm Hash digest
SHA256 eb3f3c99ec0d456ca6cd2a7f08f7d4e91771bef51b01bdd9580cc6450fe1251e
MD5 15fca82cd7deb30971b0ae8313fe44b2
BLAKE2b-256 1dceedb087fb53de63dad3b36408ca30368f438738098e668b78c87f93cd41df

See more details on using hashes here.

File details

Details for the file click_default_group-1.2.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for click_default_group-1.2.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9b60486923720e7fc61731bdb32b617039aba820e22e1c88766b1125592eaa5f
MD5 d2884fe764749a20e2ac0509feccbe45
BLAKE2b-256 2c1aaff8bb287a4b1400f69e09a53bd65de96aa5cee5691925b38731c67fc695

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.2.4 This release

2 files

1.2.3

2 files

1.2.2

1 file

1.2.1

1 file

1.2

1 file

1.1

1 file

1.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page