comparison example/example.py @ 413:f16f444a4d10

added arg_desc to @options, thanks Renzo Crispiatico
author Catherine Devlin <catherine.devlin@gmail.com>
date Fri, 12 Nov 2010 20:03:21 -0500
parents 99dd71cb477a
children bfbe4241bd6b
comparison
equal deleted inserted replaced
412:5bd1d2b11548 413:f16f444a4d10
10 Cmd.settable.append('maxrepeats Max number of `--repeat`s allowed') 10 Cmd.settable.append('maxrepeats Max number of `--repeat`s 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 ], arg_desc = '(text to say)')
16 def do_speak(self, arg, opts=None): 16 def do_speak(self, arg, opts=None):
17 """Repeats what you tell me to.""" 17 """Repeats what you tell me to."""
18 arg = ''.join(arg) 18 arg = ''.join(arg)
19 if opts.piglatin: 19 if opts.piglatin:
20 arg = '%s%say' % (arg[1:].rstrip(), arg[0]) 20 arg = '%s%say' % (arg[1:].rstrip(), arg[0])