cli-def
A declarative DSL for defining CLI structures with a unified runtime and REPL for argparse/click backends.
project page: https://cli-def.tomesoft.net
source: https://github.com/tomesoft/cli-def
What's new in 0.2.0
- Introduced Resolved model layer
- Added parameter binding (
bind) - Added
validatecommand - Improved inheritance (
inherit_from) - Added support for relative paths (
../) - Improved help and dump output
- Introduced
_earlyparsing phase
✨ Features
- Define CLI structure declaratively (TOML / Python models)
- Generate CLI implementations for:
argparse(standard library, no dependencies)click(optional dependency)
- Separation of:
- CLI definition (DSL)
- Runtime implementation (builders)
- Built-in runtime system:
- Event model (
CliEvent) - Runner
- Dispatcher
- Entrypoint resolution (
module:function) - Result propagation
- Event model (
- Interactive REPL support
- CLI chaining (execute one CLI from another)
📦 Installation
Requires Python 3.12 or later.
Core (argparse only)
pip install cli-def
With click support
pip install cli-def[click]
🚀 Quick Example
[cli]
key = "Your CLI"
help = "Help of your CLI"
prompt = "yourcli> "
[cli.echo]
args = [{key="message", mult="+"}]
cli-def run example.toml -- echo hello world
[run] forwarding args: ['echo', 'hello', 'world'], no_ctx_propagate: False
=== fallback handler ===
PATH: ['Your CLI', 'echo']
PARAMS: {'message': ['hello', 'world']}
🚀 Quick Start (Demo)
cli-def demo beginner
beginner profile reads in beginner.toml (see GitHub repository for details)
Type 'help' to list commands, 'exit' to exit
demo[beginner]> echo a b c d
a b c d
-> out[0]
demo[beginner]> greet John --upper
HELLO, JOHN!
-> out[1]
Advanced demo:
cli-def demo advanced
See profiles: https://github.com/tomesoft/cli-def/tree/main/src/cli_def/demo/profiles
🖥 Interactive Mode (REPL)
cli-def repl --file your_cli.toml
yourcli> help
yourcli> command arg1 --option value
🔁 Run Another CLI (CLI chaining)
cli-def run example.toml -- command arg1 arg2
--separates cli-def arguments from the target CLI arguments- Remaining arguments are forwarded to the next CLI
📚 Documentation
Full documentation and design details are available on GitHub:
https://github.com/tomesoft/cli-def
- DSL specification
- Architecture
- Examples
- Development notes
📌 Roadmap
See TODO.md on GitHub: https://github.com/tomesoft/cli-def/blob/main/TODO.md
🤝 Contributing
Contributions are welcome!
📄 License
MIT License
Metadata
Release files for cli-def 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cli_def-0.2.2.tar.gz | 55.4 kB | Without provenance | Details for cli_def-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cli_def-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for cli_def-0.2.2-py3-none-any.whl |
Total release size: 139.5 kB
Release files / cli_def-0.2.2.tar.gz
| Download URL | cli_def-0.2.2.tar.gz |
|---|---|
| Size | 55.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
49be9d406e4769a6b81f5ff0b01c663eae0ca2697438dcce4d058f1361030c20
|
|
BLAKE2b-256 checksum How to use checksums |
238203393d6ad3a359b1a77c75d462111d42505d2fe3047b44e494daf28154e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / cli_def-0.2.2-py3-none-any.whl
| Download URL | cli_def-0.2.2-py3-none-any.whl |
|---|---|
| Size | 84.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d1806170739a00e066f899c70a6944c526a4336f8308fde087de9455651e4bc9
|
|
BLAKE2b-256 checksum How to use checksums |
9e826b495b12a15225703ad34db5f7769da065c3940ecccfad9ee7d339189d90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for cli-def 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.