if action.help is not SUPPRESS:
# find all invocations
- get_invocation = self._format_action_invocation
+ get_invocation = lambda x: self._decolor(self._format_action_invocation(x))
invocation_lengths = [len(get_invocation(action)) + self._current_indent]
for subaction in self._iter_indented_subactions(action):
invocation_lengths.append(len(get_invocation(subaction)) + self._current_indent)
{heading}usage: {reset}{prog}PROG{reset} [{short}-h{reset}] [{short}+f {label}FOO{reset}] {pos}spam{reset}
{heading}positional arguments:{reset}
- {pos_b}spam{reset} spam help
+ {pos_b}spam{reset} spam help
{heading}options:{reset}
- {short_b}-h{reset}, {long_b}--help{reset} show this help message and exit
- {short_b}+f{reset}, {long_b}++foo{reset} {label_b}FOO{reset} foo help
+ {short_b}-h{reset}, {long_b}--help{reset} show this help message and exit
+ {short_b}+f{reset}, {long_b}++foo{reset} {label_b}FOO{reset} foo help
'''))
def test_custom_formatter_class(self):
{heading}usage: {reset}{prog}PROG{reset} [{short}-h{reset}] [{short}+f {label}FOO{reset}] {pos}spam{reset}
{heading}positional arguments:{reset}
- {pos_b}spam{reset} spam help
+ {pos_b}spam{reset} spam help
{heading}options:{reset}
- {short_b}-h{reset}, {long_b}--help{reset} show this help message and exit
- {short_b}+f{reset}, {long_b}++foo{reset} {label_b}FOO{reset} foo help
+ {short_b}-h{reset}, {long_b}--help{reset} show this help message and exit
+ {short_b}+f{reset}, {long_b}++foo{reset} {label_b}FOO{reset} foo help
'''))