summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcmd2.py2
-rwxr-xr-xexamples/arg_print.py4
-rwxr-xr-xexamples/python_scripting.py4
-rw-r--r--tests/test_argparse.py2
4 files changed, 6 insertions, 6 deletions
diff --git a/cmd2.py b/cmd2.py
index ccb1c213..84710eca 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -271,7 +271,7 @@ def with_argument_list(func):
return cmd_wrapper
-def with_argparser_and_list(argparser):
+def with_argparser_and_unknown_args(argparser):
"""A decorator to alter a cmd2 method to populate its ``args``
argument by parsing arguments with the given instance of
argparse.ArgumentParser, but also returning unknown args as a list.
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
diff --git a/tests/test_argparse.py b/tests/test_argparse.py
index 49e18d86..b425d63c 100644
--- a/tests/test_argparse.py
+++ b/tests/test_argparse.py
@@ -64,7 +64,7 @@ class ArgparseApp(cmd2.Cmd):
known_parser.add_argument('-p', '--piglatin', action='store_true', help='atinLay')
known_parser.add_argument('-s', '--shout', action='store_true', help='N00B EMULATION MODE')
known_parser.add_argument('-r', '--repeat', type=int, help='output [n] times')
- @cmd2.with_argparser_and_list(known_parser)
+ @cmd2.with_argparser_and_unknown_args(known_parser)
def do_speak(self, args, extra):
"""Repeat what you tell me to."""
words = []