diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-05-25 12:35:24 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-05-25 12:35:24 -0400 |
commit | 4c67d3372db924e87be920d89aadecb946584b31 (patch) | |
tree | bf57a15570248a2e3fbfb058a817d6c743cc9167 /examples/pirate.py | |
parent | 0e4131ba2616bd33c9cb5e93105dbd6d511a71ab (diff) | |
parent | cad21a60fa92ebe4a7c177142d273f9f7497967b (diff) | |
download | cmd2-git-4c67d3372db924e87be920d89aadecb946584b31.tar.gz |
Merge branch 'master' into pyshell_readline
Diffstat (limited to 'examples/pirate.py')
-rwxr-xr-x | examples/pirate.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/pirate.py b/examples/pirate.py index f6f4c629..34906a9f 100755 --- a/examples/pirate.py +++ b/examples/pirate.py @@ -7,15 +7,16 @@ presented as part of her PyCon 2010 talk. It demonstrates many features of cmd2. """ import argparse -from cmd2.cmd2 import Cmd, with_argparser +import cmd2 -class Pirate(Cmd): + +class Pirate(cmd2.Cmd): """A piratical example cmd2 application involving looting and drinking.""" def __init__(self): self.default_to_shell = True self.multiline_commands = ['sing'] - self.terminators = Cmd.terminators + ['...'] + self.terminators = self.terminators + ['...'] self.songcolor = 'blue' # Add stuff to settable and/or shortcuts before calling base class initializer @@ -74,7 +75,7 @@ class Pirate(Cmd): yo_parser.add_argument('-c', '--commas', action='store_true', help='Intersperse commas') yo_parser.add_argument('beverage', help='beverage to drink with the chant') - @with_argparser(yo_parser) + @cmd2.with_argparser(yo_parser) def do_yo(self, args): """Compose a yo-ho-ho type chant with flexible options.""" chant = ['yo'] + ['ho'] * args.ho |