Skip to main content

click_default_group

Project description

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.

Project details


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.3.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: click_default_group-1.2.3.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.3.tar.gz
Algorithm Hash digest
SHA256 04579c7e0cab39408babb7c7fb49795856d5e3f4736888423bc84ce86061fb3e
MD5 f2a618928769b8de3f7f2d4cd3a5565e
BLAKE2b-256 6322bbff0e364ebcb111915770b2f580fbaec7e356cb8bd8221bae65590f4433

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for click_default_group-1.2.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6cea0793e19f9bc2c9bfadaecd306d5751eb3bd51bbd7daa5e81898d14d2ba64
MD5 1b274561c9fe772bae66dd66b1f81e0d
BLAKE2b-256 437c6a119023d6a6a3f94c9a8480fd464bbbc2e90fa6c80e0be2780856568907

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page