Decli is a minimal wrapper around Python's `argparse` module, designed to simplify the creation of command-line interfaces (CLIs) using a declarative approach. It allows developers to define arguments, subcommands, and groups through Python dictionaries, promoting a clear separation between CLI definition and application logic. The library aims to reduce boilerplate commonly associated with `argparse`, making it easier to build complex CLIs. The current version is 0.6.3, and it is actively maintained.
pip install decliVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to define a basic CLI with a subcommand and an optional global argument using `decli`. The `cli` function takes a dictionary specifying the program's structure, arguments, and command functions. The example shows how to parse arguments and execute the associated function based on simulated command-line input.
Avoid defining groups within exclusive groups. Structure your CLI arguments to respect this limitation.
Familiarize yourself with fundamental `argparse` concepts and parameter behaviors to effectively leverage `decli`'s declarative capabilities and troubleshoot unexpected parsing behavior.
Restructure your CLI definition to ensure that argument groups are not nested inside exclusive groups. Exclusive groups should contain only individual optional arguments.
Install the decli library using pip: `pip install decli`. If you are working within a virtual environment, ensure it is activated before running the installation command.
Ensure that every dictionary defining an argument includes a 'name' key with a string or list of strings representing the argument's identifier(s).
When defining argument types, use the actual Python type (e.g., `int`, `str`, `float`) directly, not its string representation. For example, use `'type': int` instead of `'type': 'int'`.
No dependency data recorded yet.