Skip to content

argparse subparser help indent too short #78905

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
TakingItCasual mannequin opened this issue Sep 18, 2018 · 4 comments
Closed

argparse subparser help indent too short #78905

TakingItCasual mannequin opened this issue Sep 18, 2018 · 4 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@TakingItCasual
Copy link
Mannequin

TakingItCasual mannequin commented Sep 18, 2018

BPO 34724
Nosy @TakingItCasual

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 2018-09-18.16:49:27.712>
labels = ['type-bug', 'library']
title = 'argparse subparser help indent too short'
updated_at = <Date 2018-09-19.22:20:26.883>
user = 'https://github.com/TakingItCasual'

bugs.python.org fields:

activity = <Date 2018-09-19.22:20:26.883>
actor = 'paul.j3'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2018-09-18.16:49:27.712>
creator = 'TakingItCasual'
dependencies = []
files = []
hgrepos = []
issue_num = 34724
keywords = []
message_count = 3.0
messages = ['325663', '325665', '325808']
nosy_count = 2.0
nosy_names = ['paul.j3', 'TakingItCasual']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue34724'
versions = ['Python 3.6']

@TakingItCasual
Copy link
Mannequin Author

TakingItCasual mannequin commented Sep 18, 2018

The help is indented too early for subparsers with long argument names. I'm currently using the ProperIndentParser class from the following gist to create my top level parser, which fixes the issue:

https://gist.github.com/TakingItCasual/df40932dcc30012325bfed241bdaabd0

@TakingItCasual TakingItCasual mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Sep 18, 2018
@TakingItCasual
Copy link
Mannequin Author

TakingItCasual mannequin commented Sep 18, 2018

More detailed explanation on the SO post I found the HelpFormatter class from:

https://stackoverflow.com/q/32888815/2868017

@paulj3
Copy link
Mannequin

paulj3 mannequin commented Sep 19, 2018

Looks like I had my say on this in the Stackoverflow link (3 yrs ago).

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@slateny
Copy link
Contributor

slateny commented Jun 7, 2024

#87041 is a duplicate of this, but since that one has a handy example I'll close this one instead. The code in the gist is contained in the linked SO post which is linked in that issue too.

@slateny slateny closed this as completed Jun 7, 2024
@github-project-automation github-project-automation bot moved this from Bugs to Doc issues in Argparse issues Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

1 participant