diff --git a/kibot/config_reader.py b/kibot/config_reader.py index 07a248d1..5244befd 100644 --- a/kibot/config_reader.py +++ b/kibot/config_reader.py @@ -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:`: ` {help}.') + index = ':index:`: ` ' 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) diff --git a/tests/test_plot/test_misc.py b/tests/test_plot/test_misc.py index 554e4f00..2950d2e2 100644 --- a/tests/test_plot/test_misc.py +++ b/tests/test_plot/test_misc.py @@ -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()