summaryrefslogtreecommitdiff
path: root/examples/arg_print.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-03-07 22:34:24 -0500
committerTodd Leonhardt <todd.leonhardt@gmail.com>2018-03-07 22:34:24 -0500
commit92c5088957d03b5c76e46a337218241e5769863d (patch)
tree9ad8ce7f992e401089e05b32f4b0f9fb55001b90 /examples/arg_print.py
parent2af44735fd85cdbcfb2b43adbb3de1271ba37157 (diff)
downloadcmd2-git-92c5088957d03b5c76e46a337218241e5769863d.tar.gz
Use self.poutput() instead of print() in arg_print.py example
Diffstat (limited to 'examples/arg_print.py')
-rwxr-xr-xexamples/arg_print.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/arg_print.py b/examples/arg_print.py
index 8b02bc51..3083c0d7 100755
--- a/examples/arg_print.py
+++ b/examples/arg_print.py
@@ -34,12 +34,12 @@ class ArgumentAndOptionPrinter(cmd2.Cmd):
def do_aprint(self, arg):
"""Print the argument string this basic command is called with."""
- print('aprint was called with argument: {!r}'.format(arg))
+ self.poutput('aprint was called with argument: {!r}'.format(arg))
@with_argument_list
def do_lprint(self, arglist):
"""Print the argument list this basic command is called with."""
- print('lprint was called with the following list of arguments: {!r}'.format(arglist))
+ self.poutput('lprint was called with the following list of arguments: {!r}'.format(arglist))
oprint_parser = argparse.ArgumentParser()
oprint_parser.add_argument('-p', '--piglatin', action='store_true', help='atinLay')
@@ -50,7 +50,7 @@ class ArgumentAndOptionPrinter(cmd2.Cmd):
@with_argparser(oprint_parser)
def do_oprint(self, args):
"""Print the options and argument list this options command was called with."""
- print('oprint was called with the following\n\toptions: {!r}'.format(args))
+ self.poutput('oprint was called with the following\n\toptions: {!r}'.format(args))
pprint_parser = argparse.ArgumentParser()
pprint_parser.add_argument('-p', '--piglatin', action='store_true', help='atinLay')
@@ -59,7 +59,7 @@ class ArgumentAndOptionPrinter(cmd2.Cmd):
@with_argparser_and_unknown_args(pprint_parser)
def do_pprint(self, args, unknown):
"""Print the options and argument list this options command was called with."""
- print('oprint was called with the following\n\toptions: {!r}\n\targuments: {}'.format(args, unknown))
+ self.poutput('oprint was called with the following\n\toptions: {!r}\n\targuments: {}'.format(args, unknown))