diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-07-18 16:08:32 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-07-18 16:08:32 -0400 |
commit | 858476599f1d8ac9642c36f0a573cbd596e47a67 (patch) | |
tree | 266a272ce3a0df475372e9cb824cb7cff2ef096e /examples/table_display.py | |
parent | 8e656392c996e11642edbc5b4c6f96e4e614efeb (diff) | |
download | cmd2-git-858476599f1d8ac9642c36f0a573cbd596e47a67.tar.gz |
Renamed ArgParser to Cmd2ArgumentParser to make it clear it's a derived class of argparse.ArgumentParser
when developers read the code in cmd2.py.
Diffstat (limited to 'examples/table_display.py')
-rwxr-xr-x | examples/table_display.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/table_display.py b/examples/table_display.py index a5a5c830..a8fd2cb0 100755 --- a/examples/table_display.py +++ b/examples/table_display.py @@ -14,9 +14,11 @@ and either the colored or colorama module """ from typing import Tuple -import cmd2 import tableformatter as tf +import cmd2 +from cmd2 import Cmd2ArgumentParser + # Configure colors for when users chooses the "-c" flag to enable color in the table output try: from colored import bg @@ -142,14 +144,14 @@ def high_density_objs(row_obj: CityInfo) -> dict: return opts -def make_table_parser() -> cmd2.ArgParser: +def make_table_parser() -> Cmd2ArgumentParser: """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.ArgParser() + table_parser = Cmd2ArgumentParser() 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') |