diff options
| author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-01-15 12:38:48 -0500 |
|---|---|---|
| committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-01-15 12:38:48 -0500 |
| commit | 1f18c942fc3babf3c2183fdc2331d405d6810dc8 (patch) | |
| tree | bd4bc9643d54fd554443b9e3bfdc9f7f70ef14cd /examples | |
| parent | eee2d621abfb3d6455570b540069a4853a68f8c6 (diff) | |
| download | cmd2-git-1f18c942fc3babf3c2183fdc2331d405d6810dc8.tar.gz | |
Renamed new decorator to @with_argparser_and_unknown_args to make it more descriptive
Diffstat (limited to 'examples')
| -rwxr-xr-x | examples/arg_print.py | 4 | ||||
| -rwxr-xr-x | examples/python_scripting.py | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/examples/arg_print.py b/examples/arg_print.py index f5ec2a51..1b18cdf0 100755 --- a/examples/arg_print.py +++ b/examples/arg_print.py @@ -14,7 +14,7 @@ import argparse import cmd2 import pyparsing -from cmd2 import with_argument_list, with_argument_parser, with_argparser_and_list +from cmd2 import with_argument_list, with_argument_parser, with_argparser_and_unknown_args class ArgumentAndOptionPrinter(cmd2.Cmd): @@ -56,7 +56,7 @@ class ArgumentAndOptionPrinter(cmd2.Cmd): pprint_parser.add_argument('-p', '--piglatin', action='store_true', help='atinLay') pprint_parser.add_argument('-s', '--shout', action='store_true', help='N00B EMULATION MODE') pprint_parser.add_argument('-r', '--repeat', type=int, help='output [n] times') - @with_argparser_and_list(pprint_parser) + @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)) diff --git a/examples/python_scripting.py b/examples/python_scripting.py index a2892dc8..95cfce44 100755 --- a/examples/python_scripting.py +++ b/examples/python_scripting.py @@ -18,7 +18,7 @@ import argparse import functools import os -from cmd2 import Cmd, CmdResult, with_argument_list, with_argparser_and_list +from cmd2 import Cmd, CmdResult, with_argument_list, with_argparser_and_unknown_args class CmdLineApp(Cmd): @@ -89,7 +89,7 @@ class CmdLineApp(Cmd): dir_parser = argparse.ArgumentParser() dir_parser.add_argument('-l', '--long', action='store_true', help="display in long format with one item per line") - @with_argparser_and_list(dir_parser) + @with_argparser_and_unknown_args(dir_parser) def do_dir(self, args, unknown): """List contents of current directory.""" # No arguments for this command |
