Tofu Roll

While working on the second version of Done, a basic command line todo list tool, I realized I had written a bunch of code to generalize routing command line arguments to python methods. It seemed pretty useful, so I extracted it and turned it into a miniature framework for writing command line applications.

Code speaks louder than words, so..:

from tofuroll.tofuroll import *

class app(TofuApp):
    def hi(self, options, args):
            print "Hi, %s" %
            print "Hi there"

    def name(self):
        return {
            'help' : "someone's name"

if __name__ == '__main__':

on the command line:

$: python hi
Hi there
$: python hi -n nate
Hi, nate

For a more interesting example involving the peewee orm, check out

tofuroll can be installed via pip (pip install tofuroll) and its source is available on github.

1 note