Simple CLI Parser with command chaining
Project description
CLI Parser
Simple Chained Command Parser
This tool will allow you to create a simple command hierarchy to execute from the command line.
Example
from cli_parser import command, CliParser, ParentCommand, CommandException
get = ParentCommand('get')
@command
def product(x, y):
return x * y
@command
def sum(x, y):
return x + y
get.add_sub_cmds(product, sum)
parser = CliParser([get])
while True:
in_ = input("Enter command:\n==> ")
try:
response = parser.process_response(in_)
print(response)
except CommandException:
pass
Execute your script from the command line:
Enter command:
==> get product 5 10
50
Enter command:
==> get sum 10 20
30
Enter command:
==> q
'Quitting Interpreter'
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
cli_parser-0.1.3.tar.gz
(11.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cli_parser-0.1.3.tar.gz.
File metadata
- Download URL: cli_parser-0.1.3.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.3 CPython/3.6.7 Darwin/18.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65e0bff58c19ae26fb659d1414351b1f8e6e1e39368b9d296f50e01bac3033bb
|
|
| MD5 |
15e134f72f2219e58079827a753d820a
|
|
| BLAKE2b-256 |
d32ecd4ee8918f9404d147bd8c1bf932d22570aaee8f6edff6de5ace6bdf428d
|
File details
Details for the file cli_parser-0.1.3-py3-none-any.whl.
File metadata
- Download URL: cli_parser-0.1.3-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.3 CPython/3.6.7 Darwin/18.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3c59addc14fbc30a65072d8a8651d32b197fabc2199f99653f8fc834140a5fb
|
|
| MD5 |
8552216b2400aa0380d3eca314a361df
|
|
| BLAKE2b-256 |
c8e916494c7015b2008f4ccf399dfacf8e1dc468fdfb984840389af277b87cdc
|