While working on #766, we had a discussion on how to format the content of help messages for the scripts. In some of them, the lines are cut at a certain length, in others not. Indentation and grouping is not uniform as well. It's not that it's a problem, but there is work in the way to do it, so I share it here.
As of now, in the argparse package, there is some way to define the formatting for script's help messages. It quite basic : either display as written, do minor formatting, add defaults or add types. However, there is works on a more flexible way to customize this : python/cpython#24377. Using this as the formatter_class for the scripts would allow us to auto-set indentation for arguments, line-wrapping and some other formats.
It's near completion, which seems to be lagged by reviews from Python officials. I suppose this is good though, as the code has passed a lot of barriers and seems to be ready for merge soon. Let's keep an eye on this.
P.S. : We could already start using the ArgumentDefaultsHelpFormatter, it adds the defaults where needed in the help, no need to write the format string anymore.
While working on #766, we had a discussion on how to format the content of help messages for the scripts. In some of them, the lines are cut at a certain length, in others not. Indentation and grouping is not uniform as well. It's not that it's a problem, but there is work in the way to do it, so I share it here.
As of now, in the
argparse
package, there is some way to define the formatting for script's help messages. It quite basic : either display as written, do minor formatting, add defaults or add types. However, there is works on a more flexible way to customize this : python/cpython#24377. Using this as theformatter_class
for the scripts would allow us to auto-set indentation for arguments, line-wrapping and some other formats.It's near completion, which seems to be lagged by reviews from Python officials. I suppose this is good though, as the code has passed a lot of barriers and seems to be ready for merge soon. Let's keep an eye on this.
P.S. : We could already start using the
ArgumentDefaultsHelpFormatter
, it adds the defaults where needed in the help, no need to write the format string anymore.