2525**Completion**
2626
2727cmd2 uses its ArgparseCompleter class to enable argparse-based completion
28- on all commands that use the @with_argparse wrappers . Out of the box you get
28+ on all commands that use the @with_argparser decorator . Out of the box you get
2929completion of commands, subcommands, and flag names, as well as instructive
3030hints about the current argument that print when tab is pressed. In addition,
3131you can add completion for each argument's values using parameters passed
@@ -211,15 +211,15 @@ def get_choices(self) -> Choices:
211211**Patched argparse functions**
212212
213213``argparse._ActionsContainer.add_argument`` - adds arguments related to tab
214- completion and enables nargs range parsing. See _add_argument_wrapper for
215- more details on these arguments.
214+ completion and enables nargs range parsing. See ``__ActionsContainer_add_argument``
215+ for more details on these arguments.
216216
217217**Added accessor methods**
218218
219219cmd2 has patched ``argparse.Action`` to include the following accessor methods
220220for cases in which you need to manually access the cmd2-specific attributes.
221221
222- - ``argparse.Action.get_choices_callable()`` - See ``action_get_choices_callable `` for more details.
222+ - ``argparse.Action.get_choices_callable()`` - See ``_action_get_choices_callable `` for more details.
223223- ``argparse.Action.set_choices_provider()`` - See ``_action_set_choices_provider`` for more details.
224224- ``argparse.Action.set_completer()`` - See ``_action_set_completer`` for more details.
225225- ``argparse.Action.get_table_columns()`` - See ``_action_get_table_columns`` for more details.
@@ -665,15 +665,15 @@ def _action_set_custom_parameter(self: argparse.Action, value: Any) -> None:
665665
666666
667667############################################################################################################
668- # Patch _ActionsContainer.add_argument with our wrapper to support more arguments
668+ # Patch _ActionsContainer.add_argument to support more arguments
669669############################################################################################################
670670
671671
672- # Save original _ActionsContainer.add_argument so we can call it in our wrapper
672+ # Save original _ActionsContainer.add_argument so we can call it in our patch
673673orig_actions_container_add_argument = argparse ._ActionsContainer .add_argument
674674
675675
676- def _add_argument_wrapper (
676+ def __ActionsContainer_add_argument ( # noqa: N802
677677 self : argparse ._ActionsContainer ,
678678 * args : Any ,
679679 nargs : int | str | tuple [int ] | tuple [int , int ] | tuple [int , float ] | None = None ,
@@ -683,7 +683,7 @@ def _add_argument_wrapper(
683683 table_columns : Sequence [str | Column ] | None = None ,
684684 ** kwargs : Any ,
685685) -> argparse .Action :
686- """Wrap ActionsContainer.add_argument() to support cmd2-specific settings.
686+ """Patch ActionsContainer.add_argument() to support cmd2-specific settings.
687687
688688 # Args from original function
689689 :param self: instance of the _ActionsContainer being added to
@@ -801,8 +801,8 @@ def _add_argument_wrapper(
801801 return new_arg
802802
803803
804- # Overwrite _ActionsContainer.add_argument with our wrapper
805- setattr (argparse ._ActionsContainer , 'add_argument' , _add_argument_wrapper )
804+ # Overwrite _ActionsContainer.add_argument with our patch
805+ setattr (argparse ._ActionsContainer , 'add_argument' , __ActionsContainer_add_argument )
806806
807807
808808############################################################################################################
0 commit comments