comparison tests/example.py @ 5:005e073dc590

basic POC
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 30 Mar 2012 09:53:58 -0700
parents
children
comparison
equal deleted inserted replaced
4:5f31e56eebb6 5:005e073dc590
1 #!/usr/bin/env python
2
3 from commandparser import CommandParser
4
5
6 class Example(object):
7 """
8 a random example
9 """
10
11 def __init__(self, foo=1, bar='fleem'):
12 """
13 - foo: a number
14 - bar: a string
15 """
16 self.foo = foo
17 self.bar = bar
18
19 def execute(self, number):
20 """
21 do some stupid math
22 - number: a number to multiply by foo
23 """
24 return self.foo * int(number)
25
26 if __name__ == '__main__':
27 import sys
28 parser = CommandParser(Example)
29 parser.invoke(sys.argv[1:])