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 incorrectly shows help string on a new line in case of long command string
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: DiPaolo, paul.j3, rhettinger
Priority: normal Keywords: patch

Created on 2021-01-09 14:34 by DiPaolo, last changed 2022-04-11 14:59 by admin.

Files
File name Uploaded Description Edit
argparse-indent-sample.py DiPaolo, 2021-01-09 14:34
Pull Requests
URL Status Linked Edit
PR 24177 open DiPaolo, 2021-01-09 18:21
Messages (2)
msg384728 - (view) Author: Pavel Ditenbir (DiPaolo) * Date: 2021-01-09 14:34
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
msg385508 - (view) Author: paul j3 (paul.j3) * (Python triager) Date: 2021-01-22 19:25
This issue is discussed in:

https://bugs.python.org/issue34724
argparse subparser help indent too short

and

https://stackoverflow.com/questions/32888815/max-help-position-is-not-works-in-python-argparse-library
History
Date User Action Args
2022-04-11 14:59:40adminsetgithub: 87041
2021-01-22 19:25:32paul.j3setmessages: + msg385508
2021-01-11 22:17:23DiPaolosetversions: - Python 3.6, Python 3.7
2021-01-11 22:09:46DiPaolosetversions: + Python 3.6, Python 3.7, Python 3.8, Python 3.10
2021-01-10 14:36:26shihai1991setnosy: + rhettinger, paul.j3
2021-01-09 18:21:34DiPaolosetkeywords: + patch
stage: patch review
pull_requests: + pull_request23003
2021-01-09 14:34:59DiPaolocreate