Metadata-Version: 2.5
Name: argot-cli
Version: 0.2.0
Summary: A command-line argument parser with a simple configuration format
Project-URL: Repository, https://github.com/llucasls/argot-py.git
Project-URL: Changelog, https://github.com/llucasls/argot-py/blob/main/CHANGELOG.md
Author-email: "Lucas L. S. Haine" <lucaslshaine@gmail.com>
License-Expression: ISC
License-File: LICENSE
Requires-Python: >=3.14
Description-Content-Type: text/markdown

# ArgotCLI

ArgotCLI is a command-line argument parser designed around a simple, language-
independent configuration model. It separates command-line options, parameters,
and operands, providing a consistent approach to argument parsing across
programming languages.

This package provides the Python implementation of ArgotCLI.

## Installation

To create and activate a virtual environment, if you haven't already done so:

```sh
python -m venv .venv
. ./.venv/bin/activate
```

Then install the package with:

```sh
pip install argot-cli
```

## Usage

```python
from argot_cli import ParserConfig, ArgParser


configs = ParserConfig({
    'options': {
        'a': {'type': 'flag'},
        'o': {'type': 'text'},
        'jobs': {'type': 'int'},
        'j': {'type': 'alias', 'target': 'jobs'}
    }
})

parser = ArgParser(configs)

result = parser.parse(['name=John', '-j4', '-o', 'report.log', 'start'])
assert result['operands'][0] == 'start'
assert result['options'].get('o') == 'report.log'
assert result['options'].get('jobs') == 4
assert result['parameters'].get('name') == 'John'
```

### Argument categories

ArgotCLI distinguishes three categories of command-line input:

- **Options** represent explicitly declared arguments, such as flags and
options that accept values.
- **Parameters** use the `name=value` syntax to associate a name with a string
value.
- **Operands** are positional arguments that do not belong to the other
categories.

### Option types

Options are declared in the `options` configuration object. Supported types
include:

- `flag` — a boolean-style option.
- `text` — an option that accepts a text value.
- `int` — an option that accepts an integer.
- `float` — an option that accepts a floating-point number.
- `count` — a counter option.
- `list` — an option that collects values.
- `alias` — an alias for another option.

An alias refers to its target option, allowing multiple option names to share
the same behavior.

## License

ISC
