Skip to content

Commit 727b80d

Browse files
committed
Updated docs.
1 parent 693d700 commit 727b80d

File tree

1 file changed

+23
-26
lines changed

1 file changed

+23
-26
lines changed

cmd2/argparse_custom.py

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -222,46 +222,43 @@ def get_choices(self) -> Choices:
222222
more details on these arguments.
223223
224224
``argparse.ArgumentParser._get_nargs_pattern`` - adds support for nargs ranges.
225-
See _get_nargs_pattern_wrapper for more details.
225+
See ``_get_nargs_pattern_wrapper`` for more details.
226226
227227
``argparse.ArgumentParser._match_argument`` - adds support for nargs ranges.
228-
See _match_argument_wrapper for more details.
229-
230-
``argparse._SubParsersAction.remove_parser`` - new function which removes a
231-
sub-parser from a sub-parsers group. See _SubParsersAction_remove_parser for
232-
more details.
233-
234-
``argparse._SubParsersAction.add_existing_parser`` - new function which allows you to attach
235-
an existing ArgumentParser to a sub-parsers group. See _SubParsersAction_add_existing_parser
236-
for more details.
228+
See ``_match_argument_wrapper`` for more details.
237229
238230
**Added accessor methods**
239231
240232
cmd2 has patched ``argparse.Action`` to include the following accessor methods
241233
for cases in which you need to manually access the cmd2-specific attributes.
242234
243-
- ``argparse.Action.get_choices_callable()`` - See `action_get_choices_callable` for more details.
244-
- ``argparse.Action.set_choices_provider()`` - See `_action_set_choices_provider` for more details.
245-
- ``argparse.Action.set_completer()`` - See `_action_set_completer` for more details.
246-
- ``argparse.Action.get_table_columns()`` - See `_action_get_table_columns` for more details.
247-
- ``argparse.Action.set_table_columns()`` - See `_action_set_table_columns` for more details.
248-
- ``argparse.Action.get_nargs_range()`` - See `_action_get_nargs_range` for more details.
249-
- ``argparse.Action.set_nargs_range()`` - See `_action_set_nargs_range` for more details.
250-
- ``argparse.Action.get_suppress_tab_hint()`` - See `_action_get_suppress_tab_hint` for more details.
251-
- ``argparse.Action.set_suppress_tab_hint()`` - See `_action_set_suppress_tab_hint` for more details.
235+
- ``argparse.Action.get_choices_callable()`` - See ``action_get_choices_callable`` for more details.
236+
- ``argparse.Action.set_choices_provider()`` - See ``_action_set_choices_provider`` for more details.
237+
- ``argparse.Action.set_completer()`` - See ``_action_set_completer`` for more details.
238+
- ``argparse.Action.get_table_columns()`` - See ``_action_get_table_columns`` for more details.
239+
- ``argparse.Action.set_table_columns()`` - See ``_action_set_table_columns`` for more details.
240+
- ``argparse.Action.get_nargs_range()`` - See ``_action_get_nargs_range`` for more details.
241+
- ``argparse.Action.set_nargs_range()`` - See ``_action_set_nargs_range`` for more details.
242+
- ``argparse.Action.get_suppress_tab_hint()`` - See ``_action_get_suppress_tab_hint`` for more details.
243+
- ``argparse.Action.set_suppress_tab_hint()`` - See ``_action_set_suppress_tab_hint`` for more details.
252244
253245
cmd2 has patched ``argparse.ArgumentParser`` to include the following accessor methods
254246
255-
- ``argparse.ArgumentParser.get_ap_completer_type()`` - See `_ArgumentParser_get_ap_completer_type` for more details.
256-
- ``argparse.Action.set_ap_completer_type()`` - See `_ArgumentParser_set_ap_completer_type` for more details.
247+
- ``argparse.ArgumentParser.get_ap_completer_type()`` - See ``_ArgumentParser_get_ap_completer_type`` for more details.
248+
- ``argparse.Action.set_ap_completer_type()`` - See ``_ArgumentParser_set_ap_completer_type`` for more details.
257249
258-
**Subcommand removal**
250+
**Subcommand Manipulation**
259251
260-
cmd2 has patched ``argparse._SubParsersAction`` to include a ``remove_parser()``
261-
method which can be used to remove a subcommand.
252+
cmd2 has patched ``argparse._SubParsersAction`` with new functions to better facilitate the
253+
addition and removal of subcommand parsers.
262254
263255
``argparse._SubParsersAction.remove_parser`` - new function which removes a
264-
sub-parser from a sub-parsers group. See _SubParsersAction_remove_parser` for more details.
256+
sub-parser from a sub-parsers group. See ``_SubParsersAction_remove_parser`` for
257+
more details.
258+
259+
``argparse._SubParsersAction.add_existing_parser`` - new function which allows you to attach
260+
an existing ArgumentParser to a sub-parsers group. See ``_SubParsersAction_add_existing_parser``
261+
for more details.
265262
"""
266263

267264
import argparse
@@ -1017,7 +1014,7 @@ def _SubParsersAction_add_existing_parser( # noqa: N802
10171014
self._name_parser_map[name] = subcmd_parser
10181015

10191016
# Remap any aliases to our pre-configured parser
1020-
for alias in add_parser_kwargs.get("aliases", []):
1017+
for alias in add_parser_kwargs.get("aliases", ()):
10211018
self._name_parser_map[alias] = subcmd_parser
10221019

10231020

0 commit comments

Comments
 (0)