[New-bugs-announce] [issue25307] Enhancing the argparse help output

Sworddragon report at bugs.python.org
Sat Oct 3 22:58:03 CEST 2015


New submission from Sworddragon:

I'm noticing some things on the argparse help output that can maybe enhanced. Here is a testcase that produces an example output:

#!/usr/bin/python3 -BEOObbs
# coding=utf-8
import argparse
arguments = argparse.ArgumentParser()
arguments.add_argument('-t', '--test1', action = 'store_true', help = 'Description1')
arguments.add_argument('--test2', action = 'store_true', help = 'Description2')
arguments.add_argument('-u', '--test3', choices = ['choice1', 'choice2'], help = 'Description3', nargs = '+')
arguments.parse_args()


- A way to automatically indent names or to give the user a way to control the indentation would make them easier to read. For example --test2 is here under a short option but it would be easier to read if it would have an offset to be directly under --test1.
- The line "-u {choice1,choice2} [{choice1,choice2} ...], --test3 {choice1,choice2} [{choice1,choice2} ...]" shows the choices for every name while they are the same. Maybe they can be shortened to be shown only on the last name like "-u, --test3 {choice1,choice2} [{choice1,choice2} ...]".

----------
components: Library (Lib)
messages: 252239
nosy: Sworddragon
priority: normal
severity: normal
status: open
title: Enhancing the argparse help output
type: enhancement
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25307>
_______________________________________


More information about the New-bugs-announce mailing list