Skip to main content

lightweight & copylefted library to work with command-line arguments

Project description

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):

$ 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:

$ 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):

$ cd argumentor
$ pip install .

Usage

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

import sys
from argumentor import Argumentor
from argumentor.exc import ParsingError

argm = Argumentor("program-name")

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

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

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

More information about usage can be found in the documentation.

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.

LGPLv3 badge

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

argumentor-2.2.0.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

argumentor-2.2.0-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file argumentor-2.2.0.tar.gz.

File metadata

  • Download URL: argumentor-2.2.0.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.12

File hashes

Hashes for argumentor-2.2.0.tar.gz
Algorithm Hash digest
SHA256 ccdca84fdccfcda6a152d0f72352a80c9eb18d1d8abfa53b62859c2ece59e93d
MD5 36150e7a626c5f5721893a937b113e9b
BLAKE2b-256 cc934bb2e83753fe49ddd384315e4c194bb355927d298ecf5644c45da96e0d0a

See more details on using hashes here.

File details

Details for the file argumentor-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: argumentor-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.12

File hashes

Hashes for argumentor-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c9c2eba4bdaed18be81b577361a3bdec3eec6042230d22e6a0eb7fc5098630e
MD5 f77f32a878e4e62e40186c6551edf4e4
BLAKE2b-256 6dbc493928232d5e4f733b0bed5e474616b54a16cf0ced38ad5ec906c6e26b54

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page