Mercurial > python-cmd2
comparison example/example.py @ 309:1941e54cb776
added bash-style SELECT
author | catherine@dellzilla |
---|---|
date | Fri, 29 Jan 2010 10:32:40 -0500 |
parents | 30af90fd46c5 |
children | 9d91406ca3a7 |
comparison
equal
deleted
inserted
replaced
308:4e9011c3f732 | 309:1941e54cb776 |
---|---|
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) | |
29 | 33 |
30 do_say = do_speak # now "say" is a synonym for "speak" | 34 do_say = do_speak # now "say" is a synonym for "speak" |
31 do_orate = do_speak # another synonym, but this one takes multi-line input | 35 do_orate = do_speak # another synonym, but this one takes multi-line input |
32 | 36 |
33 c = CmdLineApp() | 37 c = CmdLineApp() |