Mercurial > python-cmd2
comparison example/example.py @ 290:cd12e4e0fa17
show -l working
author | catherine@bothari |
---|---|
date | Fri, 06 Nov 2009 21:41:55 -0500 |
parents | 1cd23003e8d5 |
children | dfdbd93a2fae |
comparison
equal
deleted
inserted
replaced
289:327ace491fa9 | 290:cd12e4e0fa17 |
---|---|
5 | 5 |
6 class CmdLineApp(Cmd): | 6 class CmdLineApp(Cmd): |
7 multilineCommands = ['orate'] | 7 multilineCommands = ['orate'] |
8 Cmd.shortcuts.update({'&': 'speak'}) | 8 Cmd.shortcuts.update({'&': 'speak'}) |
9 maxrepeats = 3 | 9 maxrepeats = 3 |
10 Cmd.settable.append('maxrepeats') | 10 Cmd.settable.append('maxrepeats Max number of `--repeat` allowed') |
11 | 11 |
12 @options([make_option('-p', '--piglatin', action="store_true", help="atinLay"), | 12 @options([make_option('-p', '--piglatin', action="store_true", help="atinLay"), |
13 make_option('-s', '--shout', action="store_true", help="N00B EMULATION MODE"), | 13 make_option('-s', '--shout', action="store_true", help="N00B EMULATION MODE"), |
14 make_option('-r', '--repeat', type="int", help="output [n] times") | 14 make_option('-r', '--repeat', type="int", help="output [n] times") |
15 ]) | 15 ]) |
41 if callopts.test: | 41 if callopts.test: |
42 CmdLineApp.testfiles = callargs | 42 CmdLineApp.testfiles = callargs |
43 sys.argv = [sys.argv[0]] # the --test argument upsets unittest.main() | 43 sys.argv = [sys.argv[0]] # the --test argument upsets unittest.main() |
44 unittest.main() | 44 unittest.main() |
45 else: | 45 else: |
46 pass | 46 CmdLineApp().cmdloop() |
47 #CmdLineApp().cmdloop() | |
48 | 47 |