This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: [argparse] Add subcommand abbreviations
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.8
process
Status: closed Resolution: duplicate
Dependencies: Superseder: argparse: allow abbreviation of sub commands by users
View: 12713
Assigned To: bethard Nosy List: bethard, paul.j3, porton, terry.reedy
Priority: normal Keywords:

Created on 2018-04-23 17:46 by porton, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg315671 - (view) Author: Victor Porton (porton) Date: 2018-04-23 17:46
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.
msg315712 - (view) Author: paul j3 (paul.j3) * (Python triager) Date: 2018-04-24 18:34
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).
msg315855 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-04-27 18:55
I am closing this as a duplicate of #12713.  Paul, if you think that also should be closed, say so there if you have not done so yet.
History
Date User Action Args
2022-04-11 14:58:59adminsetgithub: 77524
2018-04-27 18:55:34terry.reedysetstatus: open -> closed

superseder: argparse: allow abbreviation of sub commands by users
versions: + Python 3.8, - Python 3.6
nosy: + terry.reedy

messages: + msg315855
resolution: duplicate
stage: resolved
2018-04-25 01:05:22rhettingersetassignee: bethard

nosy: + bethard
2018-04-24 18:34:58paul.j3setnosy: + paul.j3
messages: + msg315712
2018-04-24 18:05:48brett.cannonsettitle: Subcommand abbreviations -> [argparse] Add subcommand abbreviations
2018-04-23 17:46:18portoncreate