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
Then 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.0.tar.gz
(3.0 kB
view hashes)
Built Distribution
Close
Hashes for cli_parser-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f447fd7bed64f1510d1e2ba8594824984b69d35c963784a94350a3cfae75603 |
|
MD5 | 5a0207d1c2dbf3b539806d906573532d |
|
BLAKE2b-256 | 6da007cc988f298815e648e5b99cc37a3009475deb2f0023d61611f2414352a5 |