diff options
| author | Eric Lin <anselor@gmail.com> | 2021-08-19 17:22:11 -0400 |
|---|---|---|
| committer | anselor <anselor@gmail.com> | 2021-08-23 14:17:12 -0400 |
| commit | 0641c902df0778774768c55ddcca3a518f13e191 (patch) | |
| tree | d600d48be3e4e4d8f019024301fe2a7defc3832e /cmd2 | |
| parent | 49805324772ec5fcd06217f4f0a241a9a8d07960 (diff) | |
| download | cmd2-git-0641c902df0778774768c55ddcca3a518f13e191.tar.gz | |
Applied black format
Diffstat (limited to 'cmd2')
| -rw-r--r-- | cmd2/__init__.py | 3 | ||||
| -rw-r--r-- | cmd2/argparse_custom.py | 1 | ||||
| -rw-r--r-- | cmd2/cmd2.py | 15 |
3 files changed, 12 insertions, 7 deletions
diff --git a/cmd2/__init__.py b/cmd2/__init__.py index 776e783c..137b3115 100644 --- a/cmd2/__init__.py +++ b/cmd2/__init__.py @@ -5,7 +5,7 @@ import sys -# For python 3.8 and late +# For python 3.8 and later if sys.version_info >= (3, 8): import importlib.metadata as importlib_metadata else: @@ -38,6 +38,7 @@ if cmd2_parser_module is not None: importlib.import_module(cmd2_parser_module) from .argparse_completer import DEFAULT_COMMAND_COMPLETER, set_default_command_completer_type + # Get the current value for argparse_custom.DEFAULT_ARGUMENT_PARSER from .argparse_custom import DEFAULT_ARGUMENT_PARSER from .cmd2 import Cmd diff --git a/cmd2/argparse_custom.py b/cmd2/argparse_custom.py index 2bcb0af9..14f3c110 100644 --- a/cmd2/argparse_custom.py +++ b/cmd2/argparse_custom.py @@ -702,6 +702,7 @@ def register_argparse_argument_parameter(param_name: str, param_type: Optional[T CUSTOM_ACTION_ATTRIBS.add(param_name) + ############################################################################################################ # Patch _ActionsContainer.add_argument with our wrapper to support more arguments ############################################################################################################ diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index a1707aee..b0637ad2 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -3117,8 +3117,9 @@ class Cmd(cmd.Cmd): " alias create save_results print_results \">\" out.txt\n" ) - alias_create_parser = argparse_custom.DEFAULT_ARGUMENT_PARSER(description=alias_create_description, - epilog=alias_create_epilog) + alias_create_parser = argparse_custom.DEFAULT_ARGUMENT_PARSER( + description=alias_create_description, epilog=alias_create_epilog + ) alias_create_parser.add_argument('name', help='name of this alias') alias_create_parser.add_argument( 'command', help='what the alias resolves to', choices_provider=_get_commands_aliases_and_macros_for_completion @@ -3300,8 +3301,9 @@ class Cmd(cmd.Cmd): " will only complete paths while typing a macro." ) - macro_create_parser = argparse_custom.DEFAULT_ARGUMENT_PARSER(description=macro_create_description, - epilog=macro_create_epilog) + macro_create_parser = argparse_custom.DEFAULT_ARGUMENT_PARSER( + description=macro_create_description, epilog=macro_create_epilog + ) macro_create_parser.add_argument('name', help='name of this macro') macro_create_parser.add_argument( 'command', help='what the macro resolves to', choices_provider=_get_commands_aliases_and_macros_for_completion @@ -3689,8 +3691,9 @@ class Cmd(cmd.Cmd): result = "\n".join('{}: {}'.format(sc[0], sc[1]) for sc in sorted_shortcuts) self.poutput(f"Shortcuts for other commands:\n{result}") - eof_parser = argparse_custom.DEFAULT_ARGUMENT_PARSER(description="Called when Ctrl-D is pressed", - epilog=INTERNAL_COMMAND_EPILOG) + eof_parser = argparse_custom.DEFAULT_ARGUMENT_PARSER( + description="Called when Ctrl-D is pressed", epilog=INTERNAL_COMMAND_EPILOG + ) @with_argparser(eof_parser) def do_eof(self, _: argparse.Namespace) -> Optional[bool]: |
