[Help] Small fixes

- To keep the output similar to previous behavior
- Also adapted some tests to new markup
This commit is contained in:
Salvador E. Tropea 2023-08-29 09:45:17 -03:00
parent 418e7c2ec6
commit 9915bbd7ae
2 changed files with 12 additions and 9 deletions

View File

@ -974,7 +974,8 @@ def print_preflights_help(rst):
help, rest = reformat_text(help, ind_size)
if rest:
help += '\n'+rest
print(f'- {extra}**{n}**: :index:`: <pair: preflights; {n}>` {help}.')
index = ':index:`: <pair: preflights; {n}>` ' if rst else ''
print(f'- {extra}**{n}**: {index}{help}.')
if options:
print_output_options(n, options, ind_size, 'preflight - '+n)
@ -1045,13 +1046,15 @@ def print_filters_help(rst):
for n, o in OrderedDict(sorted(filters.items())).items():
help = o.__doc__
if help is None:
help = 'Undocumented'
title = ''
help = ''
title = 'Undocumented'
else:
title, help = reformat_text(help, ind_size)
title = f'(**{title}**)'
print(f'- {extra}**{n}**: {title}\n{help}.')
print(f'- {extra}**{n}**: {title}')
if help:
print(f'{help}.')
print_output_options(n, o, ind_size, 'filter - '+n)

View File

@ -296,7 +296,7 @@ def test_help(test_dir):
def test_help_list_outputs(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position')
ctx.run(extra=['--help-list-outputs'], no_verbose=True, no_out_dir=True, no_yaml_file=True, no_board_file=True)
assert ctx.search_out('Supported outputs:')
assert ctx.search_out('Supported outputs')
assert ctx.search_out('Gerber format')
ctx.clean_up()
@ -331,7 +331,7 @@ def test_help_output_plugin_1(test_dir, monkeypatch):
m.setenv("HOME", os.path.join(ctx.get_board_dir(), '../..'))
logging.debug('HOME='+os.environ['HOME'])
ctx.run(extra=['--help-output', 'test'], no_verbose=True, no_out_dir=True, no_yaml_file=True, no_board_file=True)
assert ctx.search_out(r'\* Undocumented')
assert ctx.search_out(r'- Undocumented')
assert ctx.search_out('Description: No description')
assert ctx.search_out('Type: .?test.?')
assert ctx.search_out('nothing')
@ -361,7 +361,7 @@ def test_help_output_plugin_3(test_dir, monkeypatch):
m.setenv("HOME", os.path.join(ctx.get_board_dir(), '../..'))
logging.debug('HOME='+os.environ['HOME'])
ctx.run(extra=['--help-preflights'], no_verbose=True, no_out_dir=True, no_yaml_file=True, no_board_file=True)
assert ctx.search_out('- `pre_test`: Undocumented')
assert ctx.search_out(r'- \*\*pre_test\*\*: Undocumented')
ctx.clean_up()
@ -372,7 +372,7 @@ def test_help_output_plugin_4(test_dir, monkeypatch):
m.setenv("HOME", os.path.join(ctx.get_board_dir(), '../..'))
logging.debug('HOME='+os.environ['HOME'])
ctx.run(extra=['--help-filters'], no_verbose=True, no_out_dir=True, no_yaml_file=True, no_board_file=True)
assert ctx.search_out('- filter_test: Undocumented')
assert ctx.search_out(r'- \*\*filter_test\*\*: Undocumented')
ctx.clean_up()
@ -387,7 +387,7 @@ def test_help_outputs(test_dir):
def test_help_preflights(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position')
ctx.run(extra=['--help-preflights'], no_verbose=True, no_out_dir=True, no_yaml_file=True, no_board_file=True)
assert ctx.search_out('Supported preflight options')
assert ctx.search_out('Supported preflights')
ctx.clean_up()