view tests/example.py @ 12:e0a3148e67a8

bug fix and a short overhaul of documentation
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 28 Jan 2013 19:54:36 -0800
parents 005e073dc590
children
line wrap: on
line source

#!/usr/bin/env python

from commandparser import CommandParser


class Example(object):
    """
    a random example
    """

    def __init__(self, foo=1, bar='fleem'):
        """
        - foo: a number
        - bar: a string
        """
        self.foo = foo
        self.bar = bar

    def execute(self, number):
        """
        do some stupid math
        - number: a number to multiply by foo
        """
        return self.foo * int(number)

if __name__ == '__main__':
    import sys
    parser = CommandParser(Example)
    parser.invoke(sys.argv[1:])