Add a way to pass custom help formatter to call; add a multi-line HelpFormatter - #91
Add a way to pass custom help formatter to call; add a multi-line HelpFormatter#91plazer1 wants to merge 6 commits into
call; add a multi-line HelpFormatter#91Conversation
|
The problem is Hyrum’s Law - we really don't want to alter how plac works, we don't know what might break down the line:
|
|
I would be happy if I could pass my custom formatter to |
|
yes, that might work, that being said we have to keep backward and python 2.7(!) compatibility |
HelpFormatter instead of RawDescriptionHelpFormatterHelpFormatter instead of RawDescriptionHelpFormatter; add a way to pass custom help formatter to call
HelpFormatter instead of RawDescriptionHelpFormatter; add a way to pass custom help formatter to callcall; add a multi-line HelpFormatter
Hmmm.... According to the readme the lowest supported version is 2.6; however, according to the source code it's actually 2.3. So which is it: 2.3, 2.6 or 2.7? |
Add mention of the new functionality to readme
Python 2 compat
The custom improved help formatter implemented in this PR allows putting linebreaks into option descriptions as illustrated below, as well as using multi-line string literals with indented text contents (the indentation will be automatically removed). To activate this new formatter, pass
formatter_class=plac.MultilineFormattertocall().(This PR also adds
__pycache__to.gitignore.)Code:
Current output with
RawDescriptionHelpFormatter:Output with the proposed changes:
For reference, here is the output with
RawTextHelpFormatter-- it does not strip and de-dent the description text: