Skip to content

[argparse] Add subcommand abbreviations #77524

Closed

Description

@vporton
mannequin
BPO 33343
Nosy @terryjreedy, @vporton
Superseder
  • bpo-12713: argparse: allow abbreviation of sub commands by users
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2018-04-27.18:55:34.059>
    created_at = <Date 2018-04-23.17:46:18.768>
    labels = ['3.8', 'type-feature', 'library']
    title = '[argparse] Add subcommand abbreviations'
    updated_at = <Date 2018-04-27.18:55:34.056>
    user = 'https://github.com/vporton'

    bugs.python.org fields:

    activity = <Date 2018-04-27.18:55:34.056>
    actor = 'terry.reedy'
    assignee = 'bethard'
    closed = True
    closed_date = <Date 2018-04-27.18:55:34.059>
    closer = 'terry.reedy'
    components = ['Library (Lib)']
    creation = <Date 2018-04-23.17:46:18.768>
    creator = 'porton'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33343
    keywords = []
    message_count = 3.0
    messages = ['315671', '315712', '315855']
    nosy_count = 4.0
    nosy_names = ['terry.reedy', 'bethard', 'paul.j3', 'porton']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '12713'
    type = 'enhancement'
    url = 'https://bugs.python.org/issue33343'
    versions = ['Python 3.8']

    Activity

    1. vporton commented on Apr 23, 2018

      vportonmannequin
      MannequinAuthor

      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.

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-featureA feature request or enhancement
      on Apr 23, 2018
    3. changed the title [-]Subcommand abbreviations[/-] [+][argparse] Add subcommand abbreviations[/+] on Apr 24, 2018
    4. paulj3 commented on Apr 24, 2018

      paulj3mannequin
      Mannequin

      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).

    5. terryjreedy commented on Apr 27, 2018

      @terryjreedy
      Member

      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.

    6. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.8 (EOL)end of lifestdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions