From 6780baa83457f7e99ba3a9c4f6a3c27701326ac5 Mon Sep 17 00:00:00 2001 From: kotfu Date: Wed, 23 May 2018 21:16:17 -0600 Subject: Standardize cmd2 imports in tests and examples --- examples/pirate.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'examples/pirate.py') diff --git a/examples/pirate.py b/examples/pirate.py index f6f4c629..9da634aa 100755 --- a/examples/pirate.py +++ b/examples/pirate.py @@ -7,10 +7,11 @@ 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 @@ -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) + @cmd.with_argparser(yo_parser) def do_yo(self, args): """Compose a yo-ho-ho type chant with flexible options.""" chant = ['yo'] + ['ho'] * args.ho -- cgit v1.2.1 From 496933d7053f7a5de57e89b3e274db51c36de4f4 Mon Sep 17 00:00:00 2001 From: kotfu Date: Wed, 23 May 2018 22:28:03 -0600 Subject: Fix import stragglers --- examples/pirate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples/pirate.py') diff --git a/examples/pirate.py b/examples/pirate.py index 9da634aa..34906a9f 100755 --- a/examples/pirate.py +++ b/examples/pirate.py @@ -16,7 +16,7 @@ class Pirate(cmd2.Cmd): 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 @@ -75,7 +75,7 @@ class Pirate(cmd2.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') - @cmd.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 -- cgit v1.2.1