Skip to main content

Minimalist CLI.

Project description

# Minicli

Expose functions in the command line. Minimalist and pythonic.

Supports annotations and async functions.


# Usage

Example program:

from minicli import cli, run


@cli
def greetings(name, age: int, deaf=False):
"""This is an example program

:name: The name of the person we want to greet
:age: The age of the person we want to greet
:deaf: If the person is deaf, we can write louder
"""
msg = "Hi {}! So you are {} years old".format(name, age)
if deaf:
msg = msg.upper()
print(msg)


if __name__ == '__main__':
run()

Example usage:

$ myprogram.py --help
usage: myprogram.py [-h] ...

optional arguments:
-h, --help show this help message and exit

Available commands:

greetings
This is an example program

$ myprogram.py greetings --help
usage: __init__.py greetings [-h] [--deaf] name age

positional arguments:
name The name of the person we want to greet
age The age of the person we want to greet

optional arguments:
-h, --help show this help message and exit
--deaf, -d If the person is deaf, we can write louder

$ myprogram.py greetings bob 19
Hi bob! So you are 19 years old

$ myprogram.py greetings bob 19 --deaf
HI BOB! SO YOU ARE 19 YEARS OLD

$ myprogram.py greetings bob nineteen
usage: myprogram.py greetings [-h] [--deaf] name age
myprogram.py greetings: error: argument age: invalid int value: 'nineteen'

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

minicli-0.1.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

minicli-0.1.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file minicli-0.1.0.tar.gz.

File metadata

  • Download URL: minicli-0.1.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for minicli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 510d7a21971a621cee1b32c9e533d9ac5e0ef7d9cf2a8008caedab3d197d8513
MD5 7135de4e476208a7e626d4ecd7c694ac
BLAKE2b-256 e01651d2cfd42a289bc18603cc03d36271079ed4da8260affdc8cb1a163fee16

See more details on using hashes here.

File details

Details for the file minicli-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for minicli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ecac36c0e97cc3ab75de5d7279864467e29be2fca097133c95d6ac0760408162
MD5 28bb81eb57d84cdeb951544ddd504566
BLAKE2b-256 222b45feb0f9d8d02cee4000de3a5125d24f1e68e719eceefbe59cbc1f656c74

See more details on using hashes here.

Supported by

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