diff tests/example.py @ 5:005e073dc590

basic POC
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 30 Mar 2012 09:53:58 -0700
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/example.py	Fri Mar 30 09:53:58 2012 -0700
@@ -0,0 +1,29 @@
+#!/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:])