diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-01-21 22:24:09 -0500 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-01-21 22:24:09 -0500 |
commit | c9f7c012bda012b4df7a8c5e853bd5d3e6d99b1b (patch) | |
tree | e2e2f7f6ade5e61a625a3737106918e5e4362aaa /tests/test_completion.py | |
parent | 711d6380d347260a99d9ed77ce0afa7cdae67da7 (diff) | |
download | cmd2-git-c9f7c012bda012b4df7a8c5e853bd5d3e6d99b1b.tar.gz |
Renamed @with_argument_parser decorator to @with_argparser
Also:
- Reanamed foo and bar subcommand methods to base_foo and base_bar
Diffstat (limited to 'tests/test_completion.py')
-rw-r--r-- | tests/test_completion.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/test_completion.py b/tests/test_completion.py index f0efae62..05774df9 100644 --- a/tests/test_completion.py +++ b/tests/test_completion.py @@ -429,11 +429,11 @@ class SubcommandsExample(cmd2.Cmd): cmd2.Cmd.__init__(self) # sub-command functions for the base command - def foo(self, args): + def base_foo(self, args): """foo subcommand of base command""" self.poutput(args.x * args.y) - def bar(self, args): + def base_bar(self, args): """bar sucommand of base command""" self.poutput('((%s))' % args.z) @@ -445,17 +445,17 @@ class SubcommandsExample(cmd2.Cmd): parser_foo = base_subparsers.add_parser('foo', help='foo help') parser_foo.add_argument('-x', type=int, default=1, help='integer') parser_foo.add_argument('y', type=float, help='float') - parser_foo.set_defaults(func=foo) + parser_foo.set_defaults(func=base_foo) # create the parser for the "bar" sub-command parser_bar = base_subparsers.add_parser('bar', help='bar help') parser_bar.add_argument('z', help='string') - parser_bar.set_defaults(func=bar) + parser_bar.set_defaults(func=base_bar) # Create a list of subcommand names, which is used to enable tab-completion of sub-commands subcommands = ['foo', 'bar'] - @cmd2.with_argument_parser(base_parser, subcommands) + @cmd2.with_argparser(base_parser, subcommands) def do_base(self, args): """Base command help""" try: |