clime

Easily convert your Python functions into multi-command CLI program
Download

clime Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Other/Proprietary Li...
  • Price:
  • FREE
  • Publisher Name:
  • Mosky
  • Publisher web site:
  • http://docs.mosky.tw/

clime Tags


clime Description

clime is a simple Python library to let you convert a Python program contains functions into a multi-command CLI program.See the full documentation on http://docs.mosky.tw/clime.InstallationUse pip to install Clime from PyPI. sudo pip install climeOr visit our page for more methods of installation.CLI-ize ME!Here is the usage of Clime.Clime is designed to easily use, so it is very easy. You have two ways to CLI-ize your program.In Source CodeAdd two lines below into your source:>>> import clime>>> clime.main()Recommend to put the codes into the if __name__ == '__main__': block.In ShellIf you want to convert a moudle temporarily, you can use the clime command. sudo ln -s /usr/local/lib/python< VERSION >/dist-packages/clime.py /usr/bin/clime sudo chmod 755 /usr/bin/clime clime < module_name > < args_for_module >ExamplesHere is a simple example of Clime:# file: example/singlecmd.py'''Here is docstring of module.'''def onlyme(s, b=True, l=None): '''Here is docstring of function.''' print 's:', s print 'b:', b print 'l:', lif __name__ == '__main__': import clime clime.main()Use it in shell: python singlecmd.py --helpusage: singlecmd.py s or: singlecmd.py onlyme sHere is docstring of module. python singlecmd.py onlyme --helpusage: singlecmd.py onlyme sHere is docstring of function. python singlecmd.py test -b -loption_args: testb: Falsel: option_arg python singlecmd.py test -bbb -l one -l two -l threes: testb: 3l: You can find more examples under the clime/examples of source tarball of Clime.Product's homepage


clime Related Software