Giter Club home page Giter Club logo

click-groups's Introduction

click-groups

License PyPI Python Version CI codecov

Enable grouping and ordering of commands.

Would you like to split your commands into sub-groups so that they are nicely organized? Or perhaps you would like to ensure that the order of your commands stays consistent?

Now you can do this by specifying few additional group attributes.

In your click app:

import click
from click_groups import GroupedGroup

@click.group(cls=GroupedGroup)
def cli():
    pass

@cli.command(help_group="Group 1", priority=10)
def command_1():
    """Run a command."""

@cli.command(help_group="Group 1")
def command_2():
    """Run a command."""

@cli.command(help_group="Group 2")
def command_3():
    """Run a command."""

@cli.command(help_group="Group 3")
def command_4():
    """Run a command."""

@cli.command()
def command_5():
    """Run a command."""

@click.group(cls=GroupedGroup)
def command_6():
    """Run a command."""

cli.add_command(command_6)

@click.group(cls=GroupedGroup)
def command_7():
    """Run a command."""

cli.add_command(command_7, help_group="Group 1", priority=0)

Which will result in:

Usage: cli [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Group 1:
  command-7  Run a command.
  command-2  Run a command.
  command-1  Run a command.

Group 2:
  command-3  Run a command.

Group 3:
  command-4  Run a command.

Commands:
  command-5  Run a command.
  command-6  Run a command.

Contributing

Contributions are always welcome. Please feel free to submit PRs with new features, bug fixes, or documentation improvements.

git clone https://github.com/lukasz-migas/click-groups.git

pip install -e .[dev]

click-groups's People

Contributors

lukasz-migas avatar renovate[bot] avatar

Watchers

 avatar

click-groups's Issues

Add tests

Currently there are no tests - let's add a couple of tests.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v3
  • styfle/cancel-workflow-action 0.11.0
  • actions/checkout v3
  • actions/setup-python v4
  • JasonEtco/create-an-issue v2
  • codecov/codecov-action v3
  • actions/checkout v3
  • actions/setup-python v4
  • actions/checkout v3
  • actions/setup-python v4
  • softprops/action-gh-release v1
pep621
pyproject.toml
  • click >=4.0
  • pytest >=6.0
  • setuptools >= 42
  • setuptools_scm >=3.4

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.