summaryrefslogtreecommitdiff
path: root/examples/pirate.py
diff options
context:
space:
mode:
authorkotfu <jared@kotfu.net>2018-05-24 19:07:45 -0600
committerGitHub <noreply@github.com>2018-05-24 19:07:45 -0600
commitcad21a60fa92ebe4a7c177142d273f9f7497967b (patch)
tree3cfa590653af8b7570bd4073384467d2ca736fa0 /examples/pirate.py
parent5d64ebee348aeffb02fc385f903c9af431e3721b (diff)
parent190fecb34ac91e25f64615f378d6d59ef6d77de8 (diff)
downloadcmd2-git-cad21a60fa92ebe4a7c177142d273f9f7497967b.tar.gz
Merge pull request #413 from python-cmd2/speedup_import
Defer certain imports
Diffstat (limited to 'examples/pirate.py')
-rwxr-xr-xexamples/pirate.py9
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