Skip to main content

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:

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

Then install the package with:

pip install argot-cli

Usage

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

Metadata

Release files for argot-cli 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for argot-cli 0.2.0
File Size Uploaded
argot_cli-0.2.0.tar.gz 11.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for argot-cli 0.2.0
File Interpreter ABI Platform
argot_cli-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.8 kB

Release files / argot_cli-0.2.0.tar.gz

Download URL argot_cli-0.2.0.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7f8732d5f5e24a2f208a1a601abbc66a376dac1eb73d3a5abf42de7e41a0000a
BLAKE2b-256 checksum
How to use checksums
a9cf17306db069faf50ee0ab08d64f1d6f7afe73608c1a112e629aea1a47075b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release files / argot_cli-0.2.0-py3-none-any.whl

Download URL argot_cli-0.2.0-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d3236ff3b09bd338ea86700e33a81cfc700711b30017202bc33aeb50f8ff8c31
BLAKE2b-256 checksum
How to use checksums
50f8482a5ab26674a831ccf2eaf085aca258e3f3ce7181297a3bdc6b74d0a6c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page