click-groups
Enable grouping, ordering and aliasing 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? Or maybe you would like to provide aliases for your commands?
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():
"""Run commands."""
@cli.command(help_group="Group 1", priority=10)
def command_low_priority():
"""Run a command."""
click.echo("Low priority command.")
@cli.command(help_group="Group 1", aliases=["medium", "m"])
def command_medium_priority():
"""Run a command."""
click.echo("Medium priority command.")
@cli.command(help_group="Group 1", priority=0, aliases=["high", "h"])
def command_high_priority():
"""Run a command."""
click.echo("High priority command.")
@cli.group(help_group="Group 2")
def command_3():
"""Group command."""
@command_3.command(help_group="Group 2", aliases=["sub1"])
def subcommand_1():
"""Run a command."""
@cli.command(help_group="Group 3")
def command_4():
"""Run a command."""
@cli.command()
def command_5():
"""Run a command."""
@cli.group()
def command_6():
"""Run a command."""
Which will result in:
Usage: simple.py [OPTIONS] COMMAND [ARGS]...
Run commands.
Options:
--help Show this message and exit.
Group 1:
command-high-priority (h,high) Run a command.
command-medium-priority (m,medium)
Run a command.
command-low-priority Run a command.
Group 3:
command-4 Run a command.
Commands:
command-5 Run a command.
command-3 Group 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]
Metadata
Release files for click-groups 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| click_groups-0.1.6.tar.gz | 12.9 kB | Without provenance | Details for click_groups-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| click_groups-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for click_groups-0.1.6-py3-none-any.whl |
Total release size: 19.1 kB
Release files / click_groups-0.1.6.tar.gz
| Download URL | click_groups-0.1.6.tar.gz |
|---|---|
| Size | 12.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b4c8110edaf81fa38fe36b1c54a6f7af8387bf838fc9b5b3a522b5201637c5b4
|
|
BLAKE2b-256 checksum How to use checksums |
d8ebc4df9408f9748dca4ae2246cde0b3820a7f708aa7f01f6f3cbb5f5ec67cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / click_groups-0.1.6-py3-none-any.whl
| Download URL | click_groups-0.1.6-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a0db7b1c8e05aac6128fd1a56ef429b6c8b1cf900004a47841bf18a1b8380b66
|
|
BLAKE2b-256 checksum How to use checksums |
abb503f707f1f1650bf5bb284f8a8fdb291566e811db56654442ad4296950b23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Security for click-groups 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.