Metadata-Version: 2.1
Name: cliguards
Version: 0.1.0
Summary: CLI value guards for argparse and Typer.
Author-Email: FuqingZh <103730099+FuqingZh@users.noreply.github.com>
License: MIT
Requires-Python: >=3.10
Provides-Extra: typer
Requires-Dist: typer>=0.26.8; extra == "typer"
Description-Content-Type: text/markdown

# cliguards

CLI value guards for `argparse` and Typer.

## argparse

Use guards as native `argparse` `type=` converters:

```python
import argparse

from cliguards import PathGuard

parser = argparse.ArgumentParser()
parser.add_argument("--input", type=PathGuard.file("tsv", "tsv.gz"))

args = parser.parse_args()
```

## Typer

Install the optional Typer extra:

```bash
pip install "cliguards[typer]"
```

Use fluent adapters with `Annotated`:

```python
from pathlib import Path
from typing import Annotated

import typer

from cliguards import PathGuard

app = typer.Typer()


@app.command()
def run(
    input: Annotated[
        Path,
        PathGuard.file("tsv", "tsv.gz").as_typer_option("--input"),
    ],
) -> None:
    typer.echo(input)
```

## Public API

```python
from cliguards import HexColorGuard, NumericRangeGuard, PathGuard
```

V1 guards are single-value guards. They do not expose public specs, public guard
error classes, automatic help generation, or multi-value helpers.
