Skip to main content

cloup

https://img.shields.io/pypi/v/cloup.svg https://img.shields.io/travis/janLuke/cloup.svg Documentation Status

Extends pallets/click in order to add support to option groups in the command help.

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<https://github.com/click-contrib/click-option-group>, if you want that.

  • Free software: MIT license

Example

The following code:

import cloup
from cloup import option_group


@cloup.command()
@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: example.py [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 of the @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.

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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cloup-0.1.0-py2.py3-none-any.whl (4.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file cloup-0.1.0.tar.gz.

File metadata

  • Download URL: cloup-0.1.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.4

File hashes

Hashes for cloup-0.1.0.tar.gz
Algorithm Hash digest
SHA256 49738816a8fb2045586dfd353d1dccf716c7b716a1409cefd46c44506bb0d061
MD5 7f4ff3917e09116d20ebbe3d16a44767
BLAKE2b-256 701e1c9c6569619fc71130a8a7ed28c30c5e38ef92ff572435b578dabf57ea2c

See more details on using hashes here.

File details

Details for the file cloup-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: cloup-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.4

File hashes

Hashes for cloup-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 99abc2e6ac9c086220834e90712226053193602579843f77f5f4b73ac977c7b6
MD5 1c5abc48140a5f260cc0c466405e33f6
BLAKE2b-256 ecbebd00f0660559072b27661f08d2c91ff8bc475783d8309d260e9ceff1ed25

See more details on using hashes here.

Release history Release notifications | RSS feed

3.1.0

2 files

3.0.9

2 files

3.0.8

2 files

3.0.7

2 files

3.0.6

2 files

3.0.5

2 files

3.0.4

2 files

3.0.3

2 files

3.0.2

2 files

3.0.1

2 files

3.0.0

2 files

2.1.2

2 files

2.1.1

2 files

2.1.0

2 files

2.0.0.post1

2 files

2.0.0

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

0.15.1

2 files

0.15.0

2 files

0.14.0

2 files

0.13.1

2 files

0.13.0

2 files

0.12.1

2 files

0.12.0

2 files

0.11.0

2 files

0.10.0

2 files

0.9.1

2 files

0.9.0

2 files

0.8.2

2 files

0.8.1

2 files

0.8.0

2 files

0.7.1

2 files

0.7.0

2 files

0.6.1

2 files

0.6.0

2 files

0.5.0

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.2

2 files

0.1.1

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page