A minimal CLI framework for python
MicroCLI provide an easy way to create command line utilities
which can perform several related actions. One example is a calculator which can add, subtract and
compute logarithms. This is implemented in example.py
pip install microcli
or -if you want the bleeding edge-
pip install -e git+git@github.com:neumark/microcli.git@master#egg=microcli
To demonstrate the API on a very simple example, consider the following code in a file named foobar.py:
#!/usr/bin/env pythonfrommicrocliimportMicroCLI, commandclassFooBarCommand(MicroCLI):
@command()deffoo(self):
return"foo"@command()defbar(self, arg1, arg2="four"):
return"%s = %s"% (arg1, arg2)
if__name__=="__main__":
FooBarCommand.main()This could be used on the command line like this:
$ foobar.py foo # prints "foo"
$ foobar.py bar 4 # prints "4 = four"
$ foobar.py bar --arg2 good microcli # prints "microcli = good"
$ foobar.py -h # print usage info
None. At least none to run MicroCLI. For tests under python2, the contents of requirements-test.txt must be installed in the current virtualenv or globally.