Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DiPaolo mannequin opened this issue Jan 9, 2021 · 2 comments
Closed

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

DiPaolo mannequin opened this issue Jan 9, 2021 · 2 comments
Assignees
Labels
3.12 only security fixes 3.13 bugs and security fixes 3.14 bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@DiPaolo
Copy link
Mannequin

DiPaolo mannequin commented Jan 9, 2021

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

    @DiPaolo
    Copy link
    Mannequin Author

    DiPaolo mannequin commented Jan 9, 2021

    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
    

    @DiPaolo DiPaolo mannequin added 3.9 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error 3.7 (EOL) end of life 3.8 (EOL) end of life 3.10 only security fixes and removed 3.7 (EOL) end of life labels Jan 9, 2021
    @paulj3
    Copy link
    Mannequin

    paulj3 mannequin commented Jan 22, 2021

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @Eclips4 Eclips4 added 3.12 only security fixes 3.13 bugs and security fixes 3.14 bugs and security fixes and removed 3.10 only security fixes 3.9 only security fixes 3.8 (EOL) end of life labels Sep 19, 2024
    savannahostrowski added a commit to savannahostrowski/cpython that referenced this issue Sep 19, 2024
    @savannahostrowski savannahostrowski self-assigned this Sep 20, 2024
    savannahostrowski added a commit to savannahostrowski/cpython that referenced this issue Sep 23, 2024
    serhiy-storchaka pushed a commit that referenced this issue Sep 23, 2024
    In case of usage a long command along with max_help_position more than
    the length of the command, the command's help was incorrectly started
    on the new line.
    
    Co-authored-by: Pavel Ditenbir <[email protected]>
    miss-islington pushed a commit to miss-islington/cpython that referenced this issue Sep 23, 2024
    …124230)
    
    In case of usage a long command along with max_help_position more than
    the length of the command, the command's help was incorrectly started
    on the new line.
    
    (cherry picked from commit 7ee9921)
    
    Co-authored-by: Savannah Ostrowski <[email protected]>
    Co-authored-by: Pavel Ditenbir <[email protected]>
    miss-islington pushed a commit to miss-islington/cpython that referenced this issue Sep 23, 2024
    …124230)
    
    In case of usage a long command along with max_help_position more than
    the length of the command, the command's help was incorrectly started
    on the new line.
    
    (cherry picked from commit 7ee9921)
    
    Co-authored-by: Savannah Ostrowski <[email protected]>
    Co-authored-by: Pavel Ditenbir <[email protected]>
    serhiy-storchaka pushed a commit that referenced this issue Sep 23, 2024
    … (GH-124374)
    
    In case of usage a long command along with max_help_position more than
    the length of the command, the command's help was incorrectly started
    on the new line.
    
    (cherry picked from commit 7ee9921)
    
    Co-authored-by: Savannah Ostrowski <[email protected]>
    Co-authored-by: Pavel Ditenbir <[email protected]>
    @github-project-automation github-project-automation bot moved this from Bugs to Doc issues in Argparse issues Sep 24, 2024
    Yhg1s pushed a commit that referenced this issue Sep 30, 2024
    … (#124373)
    
    GH-87041: Fix incorrect indentation in argparse help (GH-124230)
    
    In case of usage a long command along with max_help_position more than
    the length of the command, the command's help was incorrectly started
    on the new line.
    
    (cherry picked from commit 7ee9921)
    
    Co-authored-by: Savannah Ostrowski <[email protected]>
    Co-authored-by: Pavel Ditenbir <[email protected]>
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.12 only security fixes 3.13 bugs and security fixes 3.14 bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    Status: Doc issues
    Development

    No branches or pull requests

    2 participants