Metadata-Version: 2.4
Name: cli-fw
Version: 0.0.3
Summary: A small dataclass-driven command-line framework
Author-email: Veya Fürst <ghgstefan@gmail.com>
License-Expression: MIT
Project-URL: Repository, https://github.com/0xveya/cli-fw
Keywords: cli,arguments,dataclass,parser
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typed-errs<1,>=0
Dynamic: license-file

# cli-fw

A compact dataclass-driven command-line framework extracted from the Pacman and
RAG projects.

```bash
uv add cli-fw
```

## Example

```python
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](https://github.com/Valentins-and-Veyas-42-group-projects/pac-man), a
work-in-progress group project in the 42 organization,
with behavior checked against
[RAG Against the Machine](https://github.com/0xveya/42-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-errs` for `Result`, `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.
