All Projects → janluke → cloup

janluke / cloup

Licence: BSD-3-Clause license
Library to build command line interfaces (CLIs) based on Click. Cloup = Click + option groups, constraints, command aliases, command sections, help themes, "did you mean ...?" suggestions ...

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to cloup

emacs-hacker-typer
A customizable implementation of http://hackertyper.com in emacs.
Stars: ✭ 21 (-52.27%)
Mutual labels:  package
eerie
The package manager for Io.
Stars: ✭ 22 (-50%)
Mutual labels:  package
listenv
R package: Environments Behaving As Lists
Stars: ✭ 20 (-54.55%)
Mutual labels:  package
flutter background
A flutter plugin to keep apps running in the background via foreground services. Currently Android only.
Stars: ✭ 58 (+31.82%)
Mutual labels:  package
packager
Laravel Package Skeleton Generator - https://youtu.be/kQRQWzDEbGk
Stars: ✭ 20 (-54.55%)
Mutual labels:  package
laravel-repoman
Set a payment deadline for the customer
Stars: ✭ 14 (-68.18%)
Mutual labels:  package
three-onEvent
Add an EventListener for Object3d in your three.js project.(support click,hover or gaze)
Stars: ✭ 55 (+25%)
Mutual labels:  click
atom-toolbar-almighty
Atom editor's missing toolbar
Stars: ✭ 21 (-52.27%)
Mutual labels:  package
pfSense-pkg-WireGuard
This is a port of the original WireGuard UI bits as implemented by Netgate in pfSense 2.5.0 to a package suitable for rapid iteration and more frequent updating on future releases of pfSense.
Stars: ✭ 194 (+340.91%)
Mutual labels:  package
GAlogger
Log R Events and R Usage to Google Analytics
Stars: ✭ 23 (-47.73%)
Mutual labels:  click
future.mapreduce
[EXPERIMENTAL] R package: future.mapreduce - Utility Functions for Future Map-Reduce API Packages
Stars: ✭ 12 (-72.73%)
Mutual labels:  package
devliver
Your private self hosted composer repository with user management
Stars: ✭ 50 (+13.64%)
Mutual labels:  package
macpack
Makes a macOS binary redistributable by searching the dependency tree and copying/patching non-system libraries.
Stars: ✭ 20 (-54.55%)
Mutual labels:  package
parse it
A python library for parsing multiple types of config files, envvars & command line arguments that takes the headache out of setting app configurations.
Stars: ✭ 86 (+95.45%)
Mutual labels:  package
Releases
A Swift package for resolving released versions from a Git repository
Stars: ✭ 46 (+4.55%)
Mutual labels:  package
elm-generative
Making generative art in Elm
Stars: ✭ 23 (-47.73%)
Mutual labels:  package
Odapter
C# code generator for Oracle packages
Stars: ✭ 16 (-63.64%)
Mutual labels:  package
secure compare
A secure compare for Elixir.
Stars: ✭ 17 (-61.36%)
Mutual labels:  package
Laravel-Tongue
🎉 Finally a subdomain localization that works how you want it to work. 🌐
Stars: ✭ 28 (-36.36%)
Mutual labels:  package
flutter web import js library
Import & use javascript libraries in your flutter web projects
Stars: ✭ 28 (-36.36%)
Mutual labels:  package

Click + option groups + constraints + aliases + help themes + ...

https://cloup.readthedocs.io/


Overview

Latest release on PyPI Supported versions Tests status Coverage Status Documentation Status (master branch) Donate with PayPal

Cloup — originally from "Click + option groups" — enriches Click with several features that make it more expressive and configurable:

  • option groups and an (optional) help section for positional arguments
  • constraints, like mutually_exclusive, that can be applied to option groups or to any group of parameters, even conditionally
  • subcommand aliases
  • subcommands sections, i.e. the possibility to organize the subcommands of a Group in multiple help sections
  • a themeable HelpFormatter that:
    • has more parameters for adjusting widths and spacing, which can be provided at the context and command level
    • use a different layout when the terminal width is below a certain threshold in order to improve readability
  • suggestions like "did you mean <subcommand>?" when you mistype a subcommand.

Moreover, Cloup improves on IDE support providing decorators with detailed type hints and adding the static methods Context.settings() and HelpFormatter.settings() for creating dictionaries of settings.

Cloup is extensively tested and documented. Tests are run against multiple versions of Python (>=3.6) and Click (>=7.2).

A simple example

from cloup import (
    HelpFormatter, HelpTheme, Style,
    command, option, option_group
)
from cloup.constraints import RequireAtLeast, mutually_exclusive

# Check the docs for all available arguments of HelpFormatter and HelpTheme.
formatter_settings = HelpFormatter.settings(
    theme=HelpTheme(
        invoked_command=Style(fg='bright_yellow'),
        heading=Style(fg='bright_white', bold=True),
        constraint=Style(fg='magenta'),
        col1=Style(fg='bright_yellow'),
    )
)

# In a multi-command app, you can pass formatter_settings as part
# of your context_settings so that they are propagated to subcommands.
@command(formatter_settings=formatter_settings)
@option_group(
    "Cool options",
    option('--foo', help='This text should describe the option --foo.'),
    option('--bar', help='This text should describe the option --bar.'),
    constraint=mutually_exclusive,
)
@option_group(
    "Other cool options",
    "This is the optional description of this option group.",
    option('--pippo', help='This text should describe the option --pippo.'),
    option('--pluto', help='This text should describe the option --pluto.'),
    constraint=RequireAtLeast(1),
)
def cmd(**kwargs):
    """This is the command description."""
    pass

if __name__ == '__main__':
    cmd(prog_name='invoked-command')

Basic example --help screenshot

If you don't provide --pippo or --pluto:

Usage: invoked-command [OPTIONS]
Try 'invoked-command --help' for help.

Error: at least 1 of the following parameters must be set:
  --pippo
  --pluto

This simple example just scratches the surface. Read more in the documentation (links below).

Supporting the project

Designing, testing and documenting a library takes a lot of time. The most concrete way to show your appreciation and to support future development is by donating. Any amount is appreciated.

Donate with PayPal

Apart from that, you can help the project by starring it on GitHub, reporting issues, proposing improvements and contributing with your code!

Links

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].