New submission from Luca <luca...@hotmail.com>:

It is often desirable to limit the help text width, for instance to 78 or 88 
columns, regardless of the actual size of the terminal window.

Currently you can achieve this in rather cumbersome ways, for instance by 
setting "os.environ['COLUMNS'] = '80'" (but this requires the "os" module, 
which may not be needed otherwise by your module, and may lead to other 
undesired effects), or by writing a custom formatting class. IMHO there should 
be a simpler option for such a basic task.

I propose to add a max_text_width parameter to ArgumentParser. This would 
require only minor code changes to argparse (see attached patch), should I open 
a pull request on GitHub?

----------
components: Library (Lib)
files: argparse_max_text_width.patch
keywords: patch
messages: 363053
nosy: lucatrv
priority: normal
severity: normal
status: open
title: argparse: add max_text_width parameter to ArgumentParser
type: enhancement
versions: Python 3.9
Added file: https://bugs.python.org/file48939/argparse_max_text_width.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39809>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to