Skip to content

Commit beed0d1

Browse files
committed
No longer setting parser's prog value in with_argparser() since it gets set in Cmd._build_parser().
1 parent 71c4130 commit beed0d1

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
- Breaking Changes
44

55
- Removed macros
6+
- No longer setting parser's `prog` value in `with_argparser()` since it gets set in
7+
`Cmd._build_parser()`. This code had previously been restored to support backward
8+
compatibility in `cmd2` 2.0 family.
69

710
- Enhancements
811
- Simplified the process to set a custom parser for `cmd2's` built-in commands. See

cmd2/decorators.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -393,14 +393,6 @@ def cmd_wrapper(*args: Any, **kwargs: dict[str, Any]) -> Optional[bool]:
393393

394394
command_name = func.__name__[len(constants.COMMAND_FUNC_PREFIX) :]
395395

396-
if isinstance(parser, argparse.ArgumentParser):
397-
# Set parser's prog value for backward compatibility within the cmd2 2.0 family.
398-
# This will be removed in cmd2 3.0 since we never reference this parser object's prog value.
399-
# Since it's possible for the same parser object to be passed into multiple with_argparser()
400-
# calls, we only set prog on the deep copies of this parser based on the specific do_xxxx
401-
# instance method they are associated with.
402-
_set_parser_prog(parser, command_name)
403-
404396
# Set some custom attributes for this command
405397
setattr(cmd_wrapper, constants.CMD_ATTR_ARGPARSER, parser)
406398
setattr(cmd_wrapper, constants.CMD_ATTR_PRESERVE_QUOTES, preserve_quotes)

0 commit comments

Comments
 (0)