From 31a932bf8ba07486fe866d54e6d515176b5adff7 Mon Sep 17 00:00:00 2001 From: Yannick DAYER <yannick.dayer@idiap.ch> Date: Wed, 19 Jul 2023 15:52:07 +0200 Subject: [PATCH] fix: format correctly the help str dedent content. --- src/clapper/click.py | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/clapper/click.py b/src/clapper/click.py index d32091e..9137796 100644 --- a/src/clapper/click.py +++ b/src/clapper/click.py @@ -107,13 +107,14 @@ def verbosity_option( default=dflt, show_default=True, help=dedent( - f"""Increase the verbosity level from 0 (only error and - critical) messages will be displayed, to 1 (like 0, but adds - warnings), 2 (like 1, but adds info messages), and 3 (like 2, - but also adds debugging messages) by adding the --{name} option - as often as desired (e.g. '-vvv' for debug). + f"""\ + Increase the verbosity level from 0 (only error and critical) + messages will be displayed, to 1 (like 0, but adds warnings), 2 + (like 1, but adds info messages), and 3 (like 2, but also adds + debugging messages) by adding the --{name} option as often as + desired (e.g. '-vvv' for debug). """ - ), + ).replace("\n", " "), callback=callback, **kwargs, )(f) @@ -180,12 +181,18 @@ class ConfigCommand(click.Command): the command-line (see below) will override the values of configuration files. You can run this command with ``<COMMAND> -H example_config.py`` to create a template config file. + """ + ) + entry_points = dedent( + f""" Available configs entry points are: {entry_points_str} + """ ) + self.extra_help = "\n\n".join((self.extra_help, entry_points)) help = "\n\n".join(((help or "").rstrip(), self.extra_help)) super().__init__(name, *args, help=help, **kwargs) @@ -388,19 +395,16 @@ class ResourceOption(click.Option): param_decls, kwargs.get("expose_value") ) help = help or "" - help = " ".join( - ( - help, - dedent( - f"""Can be a `{entry_point_group}' entry point, a module - name, or a path to a Python file which contains a - variable named '{name}'. Available entry points are: - - {entry_points_str} - """ - ), - ) + self.extra_help = dedent( + f"""\ + Can be a `{entry_point_group}' entry point, a module name, or a + path to a Python file which contains a variable named '{name}'. + Available entry points are: + + {entry_points_str} + """ ) + help = " ".join((help, self.extra_help)) super().__init__( param_decls=param_decls, -- GitLab