Option groups for pallets/click
Project description
cloup
Adds option groups to pallets/click.
This package only affects how the command help is formatted, it doesn’t (and never will) allow to specify constraints on option groups. Look at click-option-group if you want that.
Free software: MIT license
Example
The following code
import cloup
from cloup import option_group
@cloup.command('clouptest')
@option_group('Option group A', [
cloup.option('--a1', help='1st option of group A'),
cloup.option('--a2', help='2nd option of group A'),
cloup.option('--a3', help='3rd option of group A')],
help='This is a useful description of group A',
)
@option_group('Option group B', [
cloup.option('--b1', help='1st option of group B'),
cloup.option('--b2', help='end option of group B'),
cloup.option('--b3', help='3rd option of group B'),
])
@cloup.option('--opt1', help='an uncategorized option')
@cloup.option('--opt2', help='another uncategorized option')
def cli(**kwargs):
""" A CLI that does nothing. """
print(kwargs)
if __name__ == '__main__':
cli()
… will print:
Usage: clouptest [OPTIONS] A CLI that does nothing. Option group A: This is a useful description of group A --a1 TEXT 1st option of group A --a2 TEXT 2nd option of group A --a3 TEXT 3rd option of group A Option group B: --b1 TEXT 1st option of group B --b2 TEXT end option of group B --b3 TEXT 3rd option of group B Other options: --opt1 TEXT an uncategorized option --opt2 TEXT another uncategorized option --help Show this message and exit.
Credits
I started from the code writte by @chrisjsewell in this comment.
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.1.0 (2020-02-25)
First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cloup-0.1.1.tar.gz
(10.9 kB
view hashes)
Built Distribution
Close
Hashes for cloup-0.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27bd7c1e46f440bdedd763700cae6ae96f54b834f022ca0422ef0bf90020f029 |
|
MD5 | fa8f58fcb4ed86e714789a325d4059e7 |
|
BLAKE2b-256 | 4595fdc8f2a4a1ab271d4383364cbae030865c5f506902c8db72862e22623304 |