summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-07-04 16:15:14 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-07-04 16:15:14 -0400
commitb3359eb2ed03b9ede79972512978418dfe80e5ab (patch)
treefa5928ff338aa102a3e9dc341c7c383cb622073a
parent93bd8c52f2df2092d39e757f12eac0e148861536 (diff)
downloadcmd2-git-b3359eb2ed03b9ede79972512978418dfe80e5ab.tar.gz
Fixing examples
-rwxr-xr-xexamples/table_display.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/table_display.py b/examples/table_display.py
index cedd2ca0..54d5b7a4 100755
--- a/examples/table_display.py
+++ b/examples/table_display.py
@@ -15,6 +15,7 @@ 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
@@ -142,14 +143,14 @@ def high_density_objs(row_obj: CityInfo) -> dict:
return opts
-def make_table_parser() -> cmd2.argparse_completer.ACArgumentParser:
+def make_table_parser() -> Cmd2ArgParser:
"""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 = cmd2.argparse_completer.ACArgumentParser()
+ table_parser = Cmd2ArgParser()
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')