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.2.tar.gz
(10.1 kB
view hashes)
Built Distribution
Close
Hashes for pattern_cli-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | caf5d9c8eae93acee25f71e6ce687b3fdc40446a99ca39adf91893c2a149067e |
|
MD5 | 73da705c5fda5c5ec423d40c940f8b7f |
|
BLAKE2b-256 | e729f2754b50195cf021f5e76caf7b77b040a7c236b84ef8c747452e24132217 |