Moke

moke is not like make
Download

Moke Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Price:
  • FREE
  • Publisher Name:
  • Marcin Cieslik
  • Publisher web site:
  • http://muralab.org/

Moke Tags


Moke Description

Moke transforms a Python module into a script. Every function can become a sub-command, with options inferred from the argument list and the optional doc string.A command line application that greets exactly two persons. (put the following into a file called mokefile.py:from moke import task, log@taskdef greet(who, shout=False, times=1): """ Sends greetings from moke. - who(str2) two persons to greet - shout(switch) triggers CAPS """ greetings = ("Hello %s and %s!" % (who, who)) * times if shout: greetings = greetings.upper() print greetings log("greeted: %s and %s" % (who, who), INFO)if __name__ == "main": task()Execute the mokefile by calling moke:moke greet --shout -times 2 Mary Katethis returns:2011-09-30 14:12:52,815 moke (version 1.0.0)2011-09-30 14:12:52,815 cwd: "/home/.../moke/test/scripts"2011-09-30 14:12:52,815 mokefile: "/home/.../moke/test/scripts/mokefile.py"2011-09-30 14:12:52,815 task: greet2011-09-30 14:12:52,815 params: ('who', ) ('shout', True) ('times', 2)HELLO MARY AND KATE!HELLO MARY AND KATE!If you forgot what your mokefile.py does, just ask for help:moke --helpusage: mokefile.py {greet} ...positional arguments: {greet} greet Sends greetings from moke.optional arguments: -h, --help show this help message and exit -ls LS (file_a) logging stream -ll {info,warn,error} (str) logging level -lf {tab} (str) logging formatSub-command specific help is also generated:moke greet --helpusage: mokefile.py greet who whopositional arguments: who (str) two persons to greetoptional arguments: -h, --help show this help message and exit --shout (switch) triggers CAPS -times TIMES (int) Now it's time to start your own Mokefile:moke new Which creates a skeleton file for you: moke new Mokefile moke: * Created /...path.../Mokefile moke: * Running 'moke Mokefile --help'Have fun!Product's homepage


Moke Related Software