CliMate is a utility for creating robust and easily extensible command line applications. It follows different procedures to the usual command line creations and offers its own unique features. Written in Python and utilising JSON the utility put user choice first.
pip install py-climate
pip3 install py-climate
> clm
CliMate can be installed as easily as any other package using the python package manager pip. Drop the first command into your terminal and let pip do the rest. After the installation is finished, drop the second command in to get started.
cli.json
cli.py
terminal
{
"general": {},
"commands": {
"say-hello": {
"name": "Say Hello",
"description": "Say Hello To Someone",
"target": {
"type": "function"
},
"arguments": {
"someone": {
"name": "Desired Name",
"description": "Name You Desire",
"type":"str",
"default": "World"
}
}
}
}
}
from climate import CliMate
def say_hello(someone):
print("Hello, {}!".format(someone))
if __name__ == "__main__":
climate = CliMate("cli.json")
climate.parse_args()
> python cli.py say-hello
Hello, World!
> python cli.py say-hello Henry
Hello, Henry!
> python cli.py
? Main Menu Say Hello To Someone
? Desired Name (World) Fabian
Hello, Fabian!
> python cli.py help --commands
-Entry-
-cli.py- [command] {argument}
[Commands]
say-hello {name}: Say Hello To Someone
help {optional-help}: Get Help
{Arguments(s)}
name (str): Name You Desire
optional-help (choices) --docs|--commands
This will run through the procedure for making cli applications with CliMate. What better way to learn how to use it then looking at its guts.