Declarative rich CLI
Project description
deric — DEclarative RIch Cli
Minimal library to build CLI apps with integrated TOML config file.
Goals
- Minimal and useful
- Subcommand support
- Type checked arguments
- Integrated logging handling
- Reuse existing proved libraries: pydantic and rich
- Use either CLI args, environment variables or TOML configuration (or a mix of them)
Usage
simple_app.py
:
from deric import Command, arg
# define a simple app
class SimpleApp(Command):
name = "your_simple_app"
description = "Print a value and exit"
Config = {
"string": arg(str, ..., "value to print")
"value": arg(int, 4, "value to print")
}
def run(self, config):
print(config.string, config.value * 2)
SimpleApp().start()
Run it with:
python simple_app.py --string "some string" --value 21
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
deric-0.2.1.tar.gz
(6.5 kB
view hashes)
Built Distribution
deric-0.2.1-py3-none-any.whl
(6.6 kB
view hashes)