Metadata-Version: 2.4
Name: argumentor
Version: 2.0.0
Summary: lightweight & copylefted library to work with command-line arguments
Author-email: Camelia Lavender <camelia@tblock.me>
Maintainer-email: Camelia Lavender <camelia@tblock.me>
License-Expression: LGPL-3.0-or-later
Project-URL: Homepage, https://codeberg.org/camelia/python-argumentor
Project-URL: Repository, https://codeberg.org/camelia/python-argumentor
Project-URL: Issues, https://codeberg.org/camelia/python-argumentor/issues
Project-URL: Changelog, https://codeberg.org/camelia/python-argumentor/src/branch/main/CHANGELOG.md
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# argumentor

argumentor is a simple and lightweight library to build complex command-line tools.

## Features

- Differenciate commands from options
- Define aliases for commands and options
- Automatically generate help pages
- Set default values
- No external dependencies

## Installation

### Using pip

The argumentor library can be installed from the [Python Package Index (PyPI)](https://pypi.org/project/argumentor/):

```bash
$ pip install argumentor
```

### Installing from source

Using pip, it is also possible to install a package directly from source.

First clone the source code repository hosted on Codeberg:

```bash
$ git clone https://codeberg.org/camelia/python-argumentor argumentor
```

Then, enter the local repository and install argumentor (you may want to use a virtual environment):

```bash
$ cd argumentor
$ pip install .
```

## Usage

Below is a minimalist code snippet that aims to demonstrate some basic uses of argumentor:

```python title="demo.py"
import sys
from argumentor import Argumentor
from argumentor.exc import ParsingError

argm = Argumentor("program-name")

argm.add_command(
    "cmd1",
    description="command 1",
)
argm.add_command(
    "cmd2",
    description="command 2",
)

argm.add_option(
    "--opt",
    description="global option 1",
)
argm.add_option_alias("-o", "--opt")

try:
    cmd, opts = argm.parse()
except ParsingError as err:
    print(err)
    sys.exit(1)
```

More information about usage can be found in the [documentation](https://camelia.codeberg.page/python-argumentor).

## License

argumentor is free software! You are free to use, copy, modify, share and redistribute it under the terms of the [GNU Lesser General Public License, version 3 or later](https://codeberg.org/camelia/python-argumentor/src/branch/main/LICENSE).

![LGPLv3 badge](https://www.gnu.org/graphics/lgplv3-147x51.png)
