[issue39809] argparse: add max_text_width parameter to ArgumentParser

paul j3 report at bugs.python.org
Mon Mar 2 17:04:30 EST 2020


paul j3 <ajipanca at gmail.com> added the comment:

But you can replace the simple 'lambda' with a function that takes the max with 'columns'.  In other words, include: 

             width = _shutil.get_terminal_size().columns
             width -= 2
             width = min(max_text_width, width)

The only thing that the 'formatter_class' parameter requires is a callable that takes 'prog' as argument.  That can be a class, a subclass, a lambda or a function.

----------

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


More information about the Python-bugs-list mailing list