Skip to content

argparse incorrectly shows help string on a new line in case of long command string #87041

Closed

Description

@DiPaolo
mannequin
BPO 42875
Nosy @rhettinger, @DiPaolo
PRs
  • bpo-42875: fix incorrect indent of long sub-commands #24177
  • Files
  • argparse-indent-sample.py
  • 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 = None
    created_at = <Date 2021-01-09.14:34:59.534>
    labels = ['3.8', 'type-bug', 'library', '3.9', '3.10']
    title = 'argparse incorrectly shows help string on a new line in case of long command string'
    updated_at = <Date 2021-01-22.19:25:32.221>
    user = 'https://github.com/DiPaolo'

    bugs.python.org fields:

    activity = <Date 2021-01-22.19:25:32.221>
    actor = 'paul.j3'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2021-01-09.14:34:59.534>
    creator = 'DiPaolo'
    dependencies = []
    files = ['49730']
    hgrepos = []
    issue_num = 42875
    keywords = ['patch']
    message_count = 2.0
    messages = ['384728', '385508']
    nosy_count = 3.0
    nosy_names = ['rhettinger', 'paul.j3', 'DiPaolo']
    pr_nums = ['24177']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue42875'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    Linked PRs

    Activity

    1. DiPaolo commented on Jan 9, 2021

      DiPaolomannequin
      MannequinAuthor

      Steps to reproduce.

      Run the attached script:

      $ python3 argparse-indent-sample.py --help
      

      The output is:

      usage: argparse-indent-sample.py [-h] CMD ...
      
      optional arguments:
        -h, --help           show this help message and exit
      
      service:
        CMD                  command to use
          add                add something
          remove             remove something
          a-very-long-command
                             command that does something
      

      Expected output is:

      usage: argparse-indent-sample.py [-h] CMD ...
      
      optional arguments:
        -h, --help           show this help message and exit
      
      service:
        CMD                    command to use
          add                  add something
          remove               remove something
          a-very-long-command  command that does something
      
    2. added
      3.9 (EOL)
      stdlib
      type-bug
      3.7 (EOL)
      3.8 (EOL)
      3.10 (EOL)
      and removed
      3.7 (EOL)
      on Jan 9, 2021
    3. 5 remaining items

    4. added
      3.12
      3.13
      3.14
      and removed
      3.9 (EOL)
      3.8 (EOL)
      on Sep 19, 2024
    5. added a commit that references this issue on Sep 23, 2024
    6. added 2 commits that reference this issue on Sep 23, 2024
    7. added a commit that references this issue on Sep 23, 2024
    8. moved this from Bugs to Doc issues in Argparse issueson Sep 24, 2024
    9. added a commit that references this issue on Sep 30, 2024
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Labels

    3.123.133.14stdlibtype-bug

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions