Mercurial > python-cmd2
comparison example/example.py @ 310:9d91406ca3a7
select polished
author | catherine@dellzilla |
---|---|
date | Fri, 29 Jan 2010 11:26:23 -0500 |
parents | 1941e54cb776 |
children | 4172feeddf76 |
comparison
equal
deleted
inserted
replaced
309:1941e54cb776 | 310:9d91406ca3a7 |
---|---|
23 repetitions = opts.repeat or 1 | 23 repetitions = opts.repeat or 1 |
24 for i in range(min(repetitions, self.maxrepeats)): | 24 for i in range(min(repetitions, self.maxrepeats)): |
25 self.stdout.write(arg) | 25 self.stdout.write(arg) |
26 self.stdout.write('\n') | 26 self.stdout.write('\n') |
27 # self.stdout.write is better than "print", because Cmd can be | 27 # self.stdout.write is better than "print", because Cmd can be |
28 # initialized with a non-standard output destination | 28 # initialized with a non-standard output destination |
29 def do_sel(self, arg): | |
30 opts = arg.split() | |
31 result = self.select(opts) | |
32 self.poutput('yay for %s' % result) | |
33 | 29 |
34 do_say = do_speak # now "say" is a synonym for "speak" | 30 do_say = do_speak # now "say" is a synonym for "speak" |
35 do_orate = do_speak # another synonym, but this one takes multi-line input | 31 do_orate = do_speak # another synonym, but this one takes multi-line input |
36 | 32 |
37 c = CmdLineApp() | 33 c = CmdLineApp() |