It's an public package published on PyPi: https://pypi.org/project/mrMonosCli/
On Windows use command:
pip install mrMonosCli
It will download lastest package version.
On Linux/MacOS use:
$ pip3 install mrMonosCli
It is a very simple package. It has only one build-in function you can (and should) use.
add_func_to_reg()
This function make yourself defined function available to call from CLI.
Arguments in order:
- command (str) => It will be available point to your function
- function (func) => It is yourself defined function what code is executing on command It have to be without parentheses
- description (str) => This will be showing on help command
- optional Arguments (bool) => It informs about arguments existing (Do not include "self" arg)
- optional Number of arguments (int) => It informs about number of arguments (Do not include "self" arg)
It also have two parameters of main class:
prompt
and intro
Promtp
is showing on start of every line where you type command (default: CMD>)
Intro
is showing when you start program (default: Welcome in CMD!)
from mcli import main
class MyCMD(main.CMD):
def greet(self,name):
print(f"Hello {name}!")
def __init__(self):
super().__init__()
self.add_func_to_reg("greet",self.greet,"Shows greeting",True,1)
MyCMD().main_loop()
Start it.
Welcome in CMD!
CMD>
Type greet John
.
Welcome in CMD!
CMD>greet John
Hello John!
Then type greet John|greet Steve
.
CMD>greet John|greet Steve
Hello John!
Hello Steve!
You can also type help greet
.
CMD>help greet
Shows greeting
CMD>
- Package has been released.
- Some bugs have been fixed.
- Some bugs have been fixed.