summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-07-12 12:42:04 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-07-12 12:42:04 -0400
commit9bb6b84608b6262d228c021c7115e1389eed33e3 (patch)
treefe47cc9b863fd6ed0a76196dd4f27e51fdc3eb6f /examples
parent98dd8cf6a5e03e33a383c64bff4ff4b1bf2804cf (diff)
downloadcmd2-git-9bb6b84608b6262d228c021c7115e1389eed33e3.tar.gz
Renamed Cmd2ArgParser to ArgParser
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/tab_autocompletion.py6
-rwxr-xr-xexamples/table_display.py5
2 files changed, 5 insertions, 6 deletions
diff --git a/examples/tab_autocompletion.py b/examples/tab_autocompletion.py
index c4fc6218..2e611b70 100755
--- a/examples/tab_autocompletion.py
+++ b/examples/tab_autocompletion.py
@@ -8,7 +8,7 @@ import functools
from typing import List
import cmd2
-from cmd2 import utils, Cmd2ArgParser, CompletionItem
+from cmd2 import utils, CompletionItem
actors = ['Mark Hamill', 'Harrison Ford', 'Carrie Fisher', 'Alec Guinness', 'Peter Mayhew',
'Anthony Daniels', 'Adam Driver', 'Daisy Ridley', 'John Boyega', 'Oscar Isaac',
@@ -128,7 +128,7 @@ class TabCompleteExample(cmd2.Cmd):
suggest_description = "Suggest command demonstrates argparse customizations.\n"
suggest_description += "See hybrid_suggest and orig_suggest to compare the help output."
- suggest_parser = Cmd2ArgParser(description=suggest_description)
+ suggest_parser = cmd2.ArgParser(description=suggest_description)
suggest_parser.add_argument('-t', '--type', choices=['movie', 'show'], required=True)
suggest_parser.add_argument('-d', '--duration', nargs=(1, 2), action='append',
@@ -204,7 +204,7 @@ class TabCompleteExample(cmd2.Cmd):
'\n '.join(ep_list)))
print()
- video_parser = Cmd2ArgParser(prog='media')
+ video_parser = cmd2.ArgParser(prog='media')
video_types_subparsers = video_parser.add_subparsers(title='Media Types', dest='type')
diff --git a/examples/table_display.py b/examples/table_display.py
index 54d5b7a4..a5a5c830 100755
--- a/examples/table_display.py
+++ b/examples/table_display.py
@@ -15,7 +15,6 @@ and either the colored or colorama module
from typing import Tuple
import cmd2
-from cmd2.argparse_custom import Cmd2ArgParser
import tableformatter as tf
# Configure colors for when users chooses the "-c" flag to enable color in the table output
@@ -143,14 +142,14 @@ def high_density_objs(row_obj: CityInfo) -> dict:
return opts
-def make_table_parser() -> Cmd2ArgParser:
+def make_table_parser() -> cmd2.ArgParser:
"""Create a unique instance of an argparse Argument parser for processing table arguments.
NOTE: The two cmd2 argparse decorators require that each parser be unique, even if they are essentially a deep copy
of each other. For cases like that, you can create a function to return a unique instance of a parser, which is
what is being done here.
"""
- table_parser = Cmd2ArgParser()
+ table_parser = cmd2.ArgParser()
table_item_group = table_parser.add_mutually_exclusive_group()
table_item_group.add_argument('-c', '--color', action='store_true', help='Enable color')
table_item_group.add_argument('-f', '--fancy', action='store_true', help='Fancy Grid')