Fix argparse rST parsing of help messages (#14014)

Thanks!
This commit is contained in:
Adam J. Stewart 2019-12-17 12:23:22 -06:00 committed by Tamara Dahlgren
parent 189eb5b883
commit 18c2029fef

View File

@ -10,9 +10,10 @@
import sys
class ArgparseWriter(object):
class ArgparseWriter(argparse.HelpFormatter):
"""Analyzes an argparse ArgumentParser for easy generation of help."""
def __init__(self, out=sys.stdout):
super(ArgparseWriter, self).__init__(out)
self.level = 0
self.out = out
@ -48,7 +49,7 @@ def _write(self, parser, root=True, level=0):
def action_group(function, actions):
for action in actions:
arg = fmt._format_action_invocation(action)
help = action.help if action.help else ''
help = self._expand_help(action) if action.help else ''
function(arg, re.sub('\n', ' ', help))
if root: