You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
argparse: allow abbreviation of sub commands by users
A patch was implemented, and then reverted when it was found to be buggy.
Subcommands are not parsed the same as long options. Subcommands are actually 'choices' of a positional argument. Trying to allow abbreviations of subcommands allowed them in all 'choices', resulting in backward compatibility problems.
I recommend using the suparser alias mechanism instead.
Activity
vporton commentedon Apr 23, 2018
https://docs.python.org/3/library/argparse.html does not allow abbreviations for subparsers ("subcommands").
It seems inconsistent that long options can be abbreviated but subcommands cannot.
Either implement subcommand abbreviations or explain in the docs why there is none.
[-]Subcommand abbreviations[/-][+][argparse] Add subcommand abbreviations[/+]paulj3 commentedon Apr 24, 2018
This issue was raised in https://bugs.python.org/issue12713,
argparse: allow abbreviation of sub commands by users
A patch was implemented, and then reverted when it was found to be buggy.
Subcommands are not parsed the same as long options. Subcommands are actually 'choices' of a positional argument. Trying to allow abbreviations of subcommands allowed them in all 'choices', resulting in backward compatibility problems.
I recommend using the suparser alias mechanism instead.
(I think this issue should be closed).
terryjreedy commentedon Apr 27, 2018
I am closing this as a duplicate of bpo-12713. Paul, if you think that also should be closed, say so there if you have not done so yet.