Skip to content

Commit a1e253a

Browse files
committed
Updated comments.
1 parent 82100df commit a1e253a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

cmd2/argparse_custom.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,8 @@ def attach_subcommand(
888888
# Use add_parser to register the subcommand name and any aliases
889889
new_parser = subparsers_action.add_parser(subcommand, **add_parser_kwargs)
890890

891-
# Ensure the parser and any nested subparsers have the correct 'prog' value.
891+
# To ensure accurate usage strings, recursively update 'prog' values
892+
# within the injected parser to match its new location in the command hierarchy.
892893
parser.update_prog(new_parser.prog)
893894

894895
# Replace the parser created by add_parser() with our pre-configured one

cmd2/cmd2.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ def get(self, command_method: CommandFunc) -> Cmd2ArgumentParser | None:
275275
parent = self._cmd.find_commandset_for_command(command) or self._cmd
276276
parser = self._cmd._build_parser(parent, parser_builder)
277277

278-
# Ensure the parser and any nested subparsers have the correct 'prog' value.
278+
# To ensure accurate usage strings, recursively update 'prog' values
279+
# within the parser to match the command name.
279280
parser.update_prog(command)
280281

281282
# If the description has not been set, then use the method docstring if one exists

0 commit comments

Comments
 (0)