Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

click-default-group

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

click-default-group

click_default_group

  • 1.2.4
  • Source
  • PyPI
  • Socket score

Maintainers
1

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.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc