cli-fw
A compact dataclass-driven command-line framework extracted from the Pacman and RAG projects.
uv add cli-fw
Example
from dataclasses import dataclass
from cli_fw import Command, arg
@dataclass
class Serve:
port: int = arg(help="Port to listen on", default=8000)
command = Command("serve", schema=Serve)
parsed = command.execute(["--port", "8080"])
It supports positional and optional arguments, choices, booleans, lists, nested commands, generated help, and typed parse errors.
Where I use it
This is my internal CLI framework for 42 projects. The latest implementation was extracted from Pacman, a work-in-progress group project in the 42 organization, with behavior checked against RAG Against the Machine. Pacman uses it for the game command and RAG uses it to validate command syntax and produce diagnostics before command execution.
Dependencies
- Python 3.10+
typed-errsforResult,Err, and diagnostics
Development and release
Run mise run check. Every push to master publishes a unique 0.0.<CI run> ZeroVer
version through PyPI Trusted Publishing. mise run publish remains available.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cli_fw-0.0.3.tar.gz.
File metadata
- Download URL: cli_fw-0.0.3.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f8852d11a3105711cf1d5700a796bf9f3c158528014001baeaa5716e2d9052a
|
|
| MD5 |
afcea9d4066e4337b949afc94f496b25
|
|
| BLAKE2b-256 |
18929656871e30eaa984e73eddcd11fec74cf088f0eb7dc88ede2154f05eb007
|
Provenance
The following attestation bundles were made for cli_fw-0.0.3.tar.gz:
Publisher:
release.yml on 0xveya/cli-fw
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cli_fw-0.0.3.tar.gz -
Subject digest:
6f8852d11a3105711cf1d5700a796bf9f3c158528014001baeaa5716e2d9052a - Sigstore transparency entry: 2397164996
- Sigstore integration time:
-
Permalink:
0xveya/cli-fw@1f7289b9f07ce2edc917f09e089e4f0e49b8b6d7 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/0xveya
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1f7289b9f07ce2edc917f09e089e4f0e49b8b6d7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cli_fw-0.0.3-py3-none-any.whl.
File metadata
- Download URL: cli_fw-0.0.3-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7efd344b3abdd0c4c3b5a75be3cc436ed9122002e3b8a0eb66971f226ed26c91
|
|
| MD5 |
0d412920f39037f56d9f17e9e519d754
|
|
| BLAKE2b-256 |
8ffd2f2e37c3bcdbf57b519be260a887fa65c68863bc829e4634df8249d207f0
|
Provenance
The following attestation bundles were made for cli_fw-0.0.3-py3-none-any.whl:
Publisher:
release.yml on 0xveya/cli-fw
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cli_fw-0.0.3-py3-none-any.whl -
Subject digest:
7efd344b3abdd0c4c3b5a75be3cc436ed9122002e3b8a0eb66971f226ed26c91 - Sigstore transparency entry: 2397165087
- Sigstore integration time:
-
Permalink:
0xveya/cli-fw@1f7289b9f07ce2edc917f09e089e4f0e49b8b6d7 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/0xveya
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1f7289b9f07ce2edc917f09e089e4f0e49b8b6d7 -
Trigger Event:
push
-
Statement type: