diff options
author | kotfu <kotfu@kotfu.net> | 2018-01-12 21:07:44 -0700 |
---|---|---|
committer | kotfu <kotfu@kotfu.net> | 2018-01-12 21:07:44 -0700 |
commit | 19c0586b45204ac264038ce23da89858aefda46f (patch) | |
tree | e8d1375c3a00f19e5d6c86669cd65b10c25b3530 /examples | |
parent | 6895dea2e19210093e38fa411ef28dfb7f99c32c (diff) | |
download | cmd2-git-19c0586b45204ac264038ce23da89858aefda46f.tar.gz |
@with_argument_parser now passes an arglist instead of a string
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/argparse_example.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/argparse_example.py b/examples/argparse_example.py index d784ccf5..3574f549 100755 --- a/examples/argparse_example.py +++ b/examples/argparse_example.py @@ -47,7 +47,7 @@ class CmdLineApp(Cmd): argparser.add_argument('-r', '--repeat', type=int, help='output [n] times') argparser.add_argument('words', nargs='+', help='words to say') @with_argument_parser(argparser) - def do_speak(self, cmdline, args=None): + def do_speak(self, arglist, args=None): """Repeats what you tell me to.""" words = [] for word in args.words: @@ -68,7 +68,7 @@ class CmdLineApp(Cmd): argparser.add_argument('tag', nargs=1, help='tag') argparser.add_argument('content', nargs='+', help='content to surround with tag') @with_argument_parser(argparser) - def do_tag(self, argv, args=None): + def do_tag(self, arglist, args=None): self.stdout.write('<{0}>{1}</{0}>'.format(args.tag[0], ' '.join(args.content))) self.stdout.write('\n') # self.stdout.write is better than "print", because Cmd can be |