# HG changeset patch # User catherine@dellzilla # Date 1266435124 18000 # Node ID d275d3beceffa269fade5b6807bd7872850ec365 # Parent 5972ae04515e3e49e398275ecb3dff30b75d588f fix usage help name-stripping bug diff -r 5972ae04515e -r d275d3beceff cmd2.py --- a/cmd2.py Wed Feb 17 12:32:49 2010 -0500 +++ b/cmd2.py Wed Feb 17 14:32:04 2010 -0500 @@ -120,7 +120,7 @@ optionParser = OptionParser() for opt in option_list: optionParser.add_option(opt) - optionParser.set_usage("%s [options] arg" % func.__name__.strip('do_')) + optionParser.set_usage("%s [options] arg" % func.__name__[3:]) optionParser._func = func def new_func(instance, arg): try: diff -r 5972ae04515e -r d275d3beceff docs/pycon2010/pirate7.py --- a/docs/pycon2010/pirate7.py Wed Feb 17 12:32:49 2010 -0500 +++ b/docs/pycon2010/pirate7.py Wed Feb 17 14:32:04 2010 -0500 @@ -35,8 +35,11 @@ default_to_shell = True multilineCommands = ['sing'] terminators = Cmd.terminators + ['...'] + songcolor = 'blue' + settable = Cmd.settable + 'songcolor Color to ``sing`` in (red/blue/green/cyan/magenta, bold, underline)' + Cmd.shortcuts.update({'~': 'sing'}) def do_sing(self, arg): - print(self.colorize(arg, 'blue')) + print(self.colorize(arg, self.songcolor)) pirate = Pirate() pirate.cmdloop() \ No newline at end of file diff -r 5972ae04515e -r d275d3beceff docs/pycon2010/pirate8.py --- a/docs/pycon2010/pirate8.py Wed Feb 17 12:32:49 2010 -0500 +++ b/docs/pycon2010/pirate8.py Wed Feb 17 14:32:04 2010 -0500 @@ -35,8 +35,11 @@ default_to_shell = True multilineCommands = ['sing'] terminators = Cmd.terminators + ['...'] + songcolor = 'blue' + settable = Cmd.settable + 'songcolor Color to ``sing`` in (red/blue/green/cyan/magenta, bold, underline)' + Cmd.shortcuts.update({'~': 'sing'}) def do_sing(self, arg): - print(self.colorize(arg, 'blue')) + print(self.colorize(arg, self.songcolor)) @options([make_option('--ho', type='int', help="How often to chant 'ho'", default=2), make_option('-c', '--commas', action="store_true", help="Interspers commas")]) def do_yo(self, arg, opts): diff -r 5972ae04515e -r d275d3beceff docs/pycon2010/pycon2010.rst --- a/docs/pycon2010/pycon2010.rst Wed Feb 17 12:32:49 2010 -0500 +++ b/docs/pycon2010/pycon2010.rst Wed Feb 17 14:32:04 2010 -0500 @@ -242,14 +242,6 @@ * Shortcuts * Multiline commands * Environment variables - -Now how much would you pay? -=========================== - - * options / flags - * Quiet (suppress feedback) - * BASH-style ``select`` - * Parsing: terminators, suffixes Minor changes: pirate7.py ========================= @@ -259,8 +251,19 @@ default_to_shell = True multilineCommands = ['sing'] terminators = Cmd.terminators + ['...'] + songcolor = 'blue' + settable = Cmd.settable + 'songcolor Color to ``sing`` in (red/blue/green/cyan/magenta, bold, underline)' + Cmd.shortcuts.update({'~': 'sing'}) def do_sing(self, arg): - print(self.colorize(arg, 'blue')) + print(self.colorize(arg, self.songcolor)) + +Now how much would you pay? +=========================== + + * options / flags + * Quiet (suppress feedback) + * BASH-style ``select`` + * Parsing: terminators, suffixes Options: pirate8.py =================== diff -r 5972ae04515e -r d275d3beceff docs/pycon2010/script.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/pycon2010/script.txt Wed Feb 17 14:32:04 2010 -0500 @@ -0,0 +1,4 @@ +loot +loot +drink 3 +drink chardonnay \ No newline at end of file diff -r 5972ae04515e -r d275d3beceff docs/pycon2010/transcript.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/pycon2010/transcript.txt Wed Feb 17 14:32:04 2010 -0500 @@ -0,0 +1,12 @@ +arrr> loot +Now we gots 4 doubloons +arrr> loot +Now we gots 5 doubloons +arrr> drink 3 +Now we gots 2 doubloons +arrr> drink chardonnay +What's "chardonnay"? I'll take rrrum. +Now we gots 1 doubloons +arrr> quit +Quiterrr! +