mirror of
https://github.com/python/cpython.git
synced 2025-08-31 22:18:28 +00:00
gh-86463: Fix default prog in subparsers if usage is used in the main parser (GH-125891)
The usage parameter of argparse.ArgumentParser no longer affects the default value of the prog parameter in subparsers. Previously the full custom usage of the main parser was used as the prog prefix in subparsers.
This commit is contained in:
parent
46f8a7bbdb
commit
0cb4d6c654
4 changed files with 60 additions and 5 deletions
|
@ -1889,7 +1889,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
|||
formatter = self._get_formatter()
|
||||
positionals = self._get_positional_actions()
|
||||
groups = self._mutually_exclusive_groups
|
||||
formatter.add_usage(self.usage, positionals, groups, '')
|
||||
formatter.add_usage(None, positionals, groups, '')
|
||||
kwargs['prog'] = formatter.format_help().strip()
|
||||
|
||||
# create the parsers action and add it to the positionals list
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue