[New-bugs-announce] [issue42023] Argparse: Add a "display" arg

ThatXliner report at bugs.python.org
Mon Oct 12 17:18:16 EDT 2020


New submission from ThatXliner <bryan.hu.2020 at gmail.com>:

In argparse, I've always wanted a way to make colored help text like those of poetry and pipenv. But argparse's show help isn't well documented (Therefore, I can't find a way to completely modify the help text), and the metavar arg isn't really helpful. I want to do something like this:

>>> import argparse
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument("foo", help="To foo a bar", display="FOO!!!!")
>>> parser.print_help()

usage: main.py [-h] foo

positional arguments:
  FOO!!!!     To foo a bar

optional arguments:
  -h, --help  show this help message and exit

>>>

That way, I can colorize the help output.

----------
components: Library (Lib)
messages: 378526
nosy: ThatXliner
priority: normal
severity: normal
status: open
title: Argparse: Add a "display" arg
type: enhancement
versions: Python 3.10, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42023>
_______________________________________


More information about the New-bugs-announce mailing list