[issue42980] argparse: GNU-style help formatter

2021-01-22 Thread Will Noble
Will Noble added the comment: Ya I was following the precedent of non-documentation figuring that formal documentation should be done for the entire class and that would be a much larger undertaking and maybe involve further refactoring. I could potentially undertake that task in the future

[issue42980] argparse: GNU-style help formatter

2021-01-22 Thread paul j3
paul j3 added the comment: I was thinking of a refactoring that included the ', '.join(...) loop, but on further thought your refactoring might be enough for the case I raised. For example: def _format_option_with_args(self, option_string, args_string): if option_string.startswith('-

[issue42980] argparse: GNU-style help formatter

2021-01-21 Thread Will Noble
Will Noble added the comment: The main contribution of my PR is simply factoring out _format_option_with_args as an overridable method. Note that this actually enables subclassing HelpFormatter to produce all the examples you presented above with 1-3 trivial lines of code, as opposed to over

[issue42980] argparse: GNU-style help formatter

2021-01-21 Thread paul j3
paul j3 added the comment: The refactoring looks reasonable. But while we are tweaking: def _format_action_invocation(self, action): I wonder if we also give users more control over how multiple option strings are formatted. Currently if parser.add_argument('-f', '--foo', help='

[issue42980] argparse: GNU-style help formatter

2021-01-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: This sounds reasonable to me and the patch is non-invasive. Paul, what do you think? -- ___ Python tracker ___ _

[issue42980] argparse: GNU-style help formatter

2021-01-20 Thread hai shi
Change by hai shi : -- nosy: +paul.j3, rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue42980] argparse: GNU-style help formatter

2021-01-20 Thread Will Noble
Change by Will Noble : -- keywords: +patch pull_requests: +23098 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24275 ___ Python tracker ___ _

[issue42980] argparse: GNU-style help formatter

2021-01-20 Thread Will Noble
New submission from Will Noble : argparse allows GNU-style long options (with '=' in between the option and the value as opposed to a space): https://docs.python.org/3/library/argparse.html#option-value-syntax Call it pickiness, but I'd like to be able to print the help message in that forma