Skip to main content

This small python package implements a simple object-oriented layer on top of python’s argparse, offering a more intuitive and easier way to build command-line interfaces.

Quick Start

Installing Oi package.

pip install oicli

Usage example

Given the commands bellow:

$ myapp user list
$ myapp user add --name Wilson --email wilson@codeminus.org

The parser would look like this:

import oi

app = oi.App('myapp')
user_cmd = oi.Command(app, 'user')

user_list_cmd = oi.Command(user_cmd, 'list')

user_add_cmd = oi.Command(user_cmd, 'add')
user_add_cmd.add_argument('--name')
user_add_cmd.add_argument('--email')

print(app.parse_args())

Running the application with the code above:

$ myapp user
Namespace(command='user')
$ myapp user list
Namespace(command='user_list')
$ myapp user add --name Wilson --email wilson@codeminus.org
Namespace(command='user_add', email='wilson@codeminus.org', name='Wilson')

Notice the command attribute of the Namespace. It correspond to the name of the command invoked. The sub-command name is appended to its parent command to ensure a unique identifier is created.

What does “Oi” mean? Well… What does it mean to you? Try the wiki.

Metadata

Release files for oicli 0.3.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 oicli 0.3.0
File Size Uploaded Provenance Actions
oicli-0.3.0.tar.gz 3.8 kB Without provenance Details for oicli-0.3.0.tar.gz

Release files / oicli-0.3.0.tar.gz

Download URL oicli-0.3.0.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
fbb14be05bd3be470a8f2ddcd6784dc6c29db55e3a9e0e9a139da3a8732eafc3
BLAKE2b-256 checksum
How to use checksums
0c76d8ee855cdb13f2475302e10c81af9330a109467c52193a25711d110950e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

Security for oicli 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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