Mercurial > hg > CommandParser
comparison tests/simpleexample.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 | |
| children |
comparison
equal
deleted
inserted
replaced
| 11:03db23600c1f | 12:e0a3148e67a8 |
|---|---|
| 1 #!/usr/bin/env python | |
| 2 | |
| 3 class Foo(object): | |
| 4 """silly class that does nothing""" | |
| 5 def __init__(self): pass | |
| 6 def foo(self, value): | |
| 7 print "The value is %s" % value | |
| 8 def bar(self, fleem, verbose=False): | |
| 9 """ | |
| 10 The good ole `bar` command | |
| 11 - fleem: you know, that thing fleem | |
| 12 - verbose: whether to print out more things or not | |
| 13 """ | |
| 14 if verbose: | |
| 15 print "You gave fleem=%s" % fleem | |
| 16 return fleem * 2 | |
| 17 | |
| 18 import commandparser | |
| 19 parser = commandparser.CommandParser(Foo) | |
| 20 parser.invoke() |
