Make command-line interface scripts with ease
Project description
Cli
Cli is a Python library to help create command-line interfaces with ease.
Installation
pip install git+https://github.com/HashLDash/cli
Usage
from cli import cli
@cli("hello")
def hello():
''' This is a test command '''
print("Hello, World!")
@cli("add <int:a> <int:b>")
def add(a, b):
print(f'Adding {a} + {b} = {a+b}')
This would add two commands (and automagically a help command) that can be called like:
$ python command.py hello
Hello, World!
$ python command.py add 5 4
Adding 5 + 4 = 9
$ python command.py help
command.py help
hello - This is a test command
You can also add shebangs, ommit the extension and link to your path to create a command for using like:
$ command hello
Hello, World!
$ command add 5 4
Adding 5 + 4 = 9
TODO
This is still in development. The following is planned:
- Handling of keyword arguments
- Increase supported types
Feel free to open issues for bugs and feature requests.
PRs are welcome too!
Enjoy :)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pattern-cli-0.0.1.tar.gz
(10.0 kB
view hashes)
Built Distribution
Close
Hashes for pattern_cli-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a9b76e3ffdf628b01d3d56b52906f205f03c5e838638c387615be07f535bccf |
|
MD5 | 2137496139d9cbf21225ca95661af633 |
|
BLAKE2b-256 | 832c0b6f2a8158c1c4657f97979853f424325424cbe0ec50179225fe2a6f8785 |