Option groups missing in Click
Maintained. Last release 2 weeks ago, commits in 1 of the last 26 weeks. Weaker on commit activity and release cadence.
pip install click-option-groupclick-option-group
click-option-group is a Click-extension package that adds option groups missing in Click.
Aim and Motivation
Click is a package for creating powerful and beautiful command line interfaces (CLI) in Python, but it has no the functionality for creating option groups.
Option groups are convenient mechanism for logical structuring CLI, also it allows you to set the specific behavior and set the relationship among grouped options (mutually exclusive options for example). Moreover, argparse stdlib package contains this functionality out of the box.
At the same time, many Click users need this functionality. You can read interesting discussions about it in the following issues:
The aim of this package is to provide group options with extensible functionality using canonical and clean API (Click-like API as far as possible).
Quickstart
Installing
Install and update using pip:
pip install -U click-option-group
A Simple Example
Here is a simple example how to use option groups in your Click-based CLI. Just use for declaring option groups by decorating your command function in Click-like API style.