diff --git a/README.md b/README.md index bcc60ce9..97dc7b5d 100644 --- a/README.md +++ b/README.md @@ -470,6 +470,7 @@ STYLE_METAVAR = "bold yellow" STYLE_METAVAR_APPEND = "dim yellow" STYLE_METAVAR_SEPARATOR = "dim" STYLE_HEADER_TEXT = "" +STYLE_EPILOG_TEXT = "" STYLE_FOOTER_TEXT = "" STYLE_USAGE = "yellow" STYLE_USAGE_COMMAND = "bold" diff --git a/src/rich_click/rich_click.py b/src/rich_click/rich_click.py index 4548291f..215c1709 100644 --- a/src/rich_click/rich_click.py +++ b/src/rich_click/rich_click.py @@ -54,6 +54,7 @@ STYLE_METAVAR_APPEND: rich.style.StyleType = "dim yellow" STYLE_METAVAR_SEPARATOR: rich.style.StyleType = "dim" STYLE_HEADER_TEXT: rich.style.StyleType = "" +STYLE_EPILOG_TEXT: rich.style.StyleType = "" STYLE_FOOTER_TEXT: rich.style.StyleType = "" STYLE_USAGE: rich.style.StyleType = "yellow" STYLE_USAGE_COMMAND: rich.style.StyleType = "bold" @@ -722,7 +723,7 @@ class MetavarHighlighter(RegexHighlighter): # Remove single linebreaks, replace double with single lines = obj.epilog.split("\n\n") epilogue = "\n".join([x.replace("\n", " ").strip() for x in lines]) - console.print(Padding(Align(highlighter(epilogue), pad=False), 1)) + console.print(Padding(Align(_make_rich_rext(epilogue, config.style_epilog_text, formatter), pad=False), 1)) # Footer text if we have it if config.footer_text: @@ -820,6 +821,7 @@ def get_module_help_configuration() -> RichHelpConfiguration: STYLE_METAVAR_APPEND, STYLE_METAVAR_SEPARATOR, STYLE_HEADER_TEXT, + STYLE_EPILOG_TEXT, STYLE_FOOTER_TEXT, STYLE_USAGE, STYLE_USAGE_COMMAND, diff --git a/src/rich_click/rich_help_configuration.py b/src/rich_click/rich_help_configuration.py index e9eccc12..ab0c715a 100644 --- a/src/rich_click/rich_help_configuration.py +++ b/src/rich_click/rich_help_configuration.py @@ -59,6 +59,7 @@ class RichHelpConfiguration: style_metavar_append: rich.style.StyleType = field(default="dim yellow") style_metavar_separator: rich.style.StyleType = field(default="dim") style_header_text: rich.style.StyleType = field(default="") + style_epilog_text: rich.style.StyleType = field(default="") style_footer_text: rich.style.StyleType = field(default="") style_usage: rich.style.StyleType = field(default="yellow") style_usage_command: rich.style.StyleType = field(default="bold") diff --git a/tests/expectations/test_rich_click[test arguments with rich_config]-click8.config.json b/tests/expectations/test_rich_click[test arguments with rich_config]-click8.config.json index c4610574..057a2f89 100644 --- a/tests/expectations/test_rich_click[test arguments with rich_config]-click8.config.json +++ b/tests/expectations/test_rich_click[test arguments with rich_config]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold", diff --git a/tests/expectations/test_rich_click[test arguments]-click8.config.json b/tests/expectations/test_rich_click[test arguments]-click8.config.json index c4610574..057a2f89 100644 --- a/tests/expectations/test_rich_click[test arguments]-click8.config.json +++ b/tests/expectations/test_rich_click[test arguments]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold", diff --git a/tests/expectations/test_rich_click[test command column alignment]-click8.config.json b/tests/expectations/test_rich_click[test command column alignment]-click8.config.json index ef571ea2..bbd217dd 100644 --- a/tests/expectations/test_rich_click[test command column alignment]-click8.config.json +++ b/tests/expectations/test_rich_click[test command column alignment]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold", diff --git a/tests/expectations/test_rich_click[test context_settings]-click8.config.json b/tests/expectations/test_rich_click[test context_settings]-click8.config.json index bf5e5345..cc6e6f2c 100644 --- a/tests/expectations/test_rich_click[test context_settings]-click8.config.json +++ b/tests/expectations/test_rich_click[test context_settings]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold", diff --git a/tests/expectations/test_rich_click[test custom errors help]-click8.config.json b/tests/expectations/test_rich_click[test custom errors help]-click8.config.json index 36f5fd45..c2d95ebc 100644 --- a/tests/expectations/test_rich_click[test custom errors help]-click8.config.json +++ b/tests/expectations/test_rich_click[test custom errors help]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold", diff --git a/tests/expectations/test_rich_click[test custom errors with rich_config]-click8.config.json b/tests/expectations/test_rich_click[test custom errors with rich_config]-click8.config.json index 36f5fd45..c2d95ebc 100644 --- a/tests/expectations/test_rich_click[test custom errors with rich_config]-click8.config.json +++ b/tests/expectations/test_rich_click[test custom errors with rich_config]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold", diff --git a/tests/expectations/test_rich_click[test declarative with rich_config]-click8.config.json b/tests/expectations/test_rich_click[test declarative with rich_config]-click8.config.json index bf5e5345..cc6e6f2c 100644 --- a/tests/expectations/test_rich_click[test declarative with rich_config]-click8.config.json +++ b/tests/expectations/test_rich_click[test declarative with rich_config]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold", diff --git a/tests/expectations/test_rich_click[test declarative]-click8.config.json b/tests/expectations/test_rich_click[test declarative]-click8.config.json index bf5e5345..cc6e6f2c 100644 --- a/tests/expectations/test_rich_click[test declarative]-click8.config.json +++ b/tests/expectations/test_rich_click[test declarative]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold", diff --git a/tests/expectations/test_rich_click[test environment variables with rich_config]-click8.config.json b/tests/expectations/test_rich_click[test environment variables with rich_config]-click8.config.json index bf5e5345..cc6e6f2c 100644 --- a/tests/expectations/test_rich_click[test environment variables with rich_config]-click8.config.json +++ b/tests/expectations/test_rich_click[test environment variables with rich_config]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold", diff --git a/tests/expectations/test_rich_click[test envvar]-click8.config.json b/tests/expectations/test_rich_click[test envvar]-click8.config.json index bf5e5345..cc6e6f2c 100644 --- a/tests/expectations/test_rich_click[test envvar]-click8.config.json +++ b/tests/expectations/test_rich_click[test envvar]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold", diff --git a/tests/expectations/test_rich_click[test group sorting]-click8.config.json b/tests/expectations/test_rich_click[test group sorting]-click8.config.json index 515ac478..176917e6 100644 --- a/tests/expectations/test_rich_click[test group sorting]-click8.config.json +++ b/tests/expectations/test_rich_click[test group sorting]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold", diff --git a/tests/expectations/test_rich_click[test groups sorting with rich_config]-click8.config.json b/tests/expectations/test_rich_click[test groups sorting with rich_config]-click8.config.json index 515ac478..176917e6 100644 --- a/tests/expectations/test_rich_click[test groups sorting with rich_config]-click8.config.json +++ b/tests/expectations/test_rich_click[test groups sorting with rich_config]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold", diff --git a/tests/expectations/test_rich_click[test markdown with rich_config]-click8.config.json b/tests/expectations/test_rich_click[test markdown with rich_config]-click8.config.json index a4665cd4..09a68366 100644 --- a/tests/expectations/test_rich_click[test markdown with rich_config]-click8.config.json +++ b/tests/expectations/test_rich_click[test markdown with rich_config]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold", diff --git a/tests/expectations/test_rich_click[test markdown]-click8.config.json b/tests/expectations/test_rich_click[test markdown]-click8.config.json index a4665cd4..09a68366 100644 --- a/tests/expectations/test_rich_click[test markdown]-click8.config.json +++ b/tests/expectations/test_rich_click[test markdown]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold", diff --git a/tests/expectations/test_rich_click[test metavars default with rich_config]-click8.config.json b/tests/expectations/test_rich_click[test metavars default with rich_config]-click8.config.json index bf5e5345..cc6e6f2c 100644 --- a/tests/expectations/test_rich_click[test metavars default with rich_config]-click8.config.json +++ b/tests/expectations/test_rich_click[test metavars default with rich_config]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold", diff --git a/tests/expectations/test_rich_click[test metavars default]-click8.config.json b/tests/expectations/test_rich_click[test metavars default]-click8.config.json index bf5e5345..cc6e6f2c 100644 --- a/tests/expectations/test_rich_click[test metavars default]-click8.config.json +++ b/tests/expectations/test_rich_click[test metavars default]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold", diff --git a/tests/expectations/test_rich_click[test metavars with rich_config]-click8.config.json b/tests/expectations/test_rich_click[test metavars with rich_config]-click8.config.json index f7f518ac..ea80c930 100644 --- a/tests/expectations/test_rich_click[test metavars with rich_config]-click8.config.json +++ b/tests/expectations/test_rich_click[test metavars with rich_config]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold", diff --git a/tests/expectations/test_rich_click[test metavars]-click8.config.json b/tests/expectations/test_rich_click[test metavars]-click8.config.json index f7f518ac..ea80c930 100644 --- a/tests/expectations/test_rich_click[test metavars]-click8.config.json +++ b/tests/expectations/test_rich_click[test metavars]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold", diff --git a/tests/expectations/test_rich_click[test rich markup with rich_config]-click8.config.json b/tests/expectations/test_rich_click[test rich markup with rich_config]-click8.config.json index e4dc944f..0e9627ea 100644 --- a/tests/expectations/test_rich_click[test rich markup with rich_config]-click8.config.json +++ b/tests/expectations/test_rich_click[test rich markup with rich_config]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold", diff --git a/tests/expectations/test_rich_click[test rich markup]-click8.config.json b/tests/expectations/test_rich_click[test rich markup]-click8.config.json index e4dc944f..0e9627ea 100644 --- a/tests/expectations/test_rich_click[test rich markup]-click8.config.json +++ b/tests/expectations/test_rich_click[test rich markup]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold", diff --git a/tests/expectations/test_rich_click[test simple with rich_config]-click8.config.json b/tests/expectations/test_rich_click[test simple with rich_config]-click8.config.json index bf5e5345..cc6e6f2c 100644 --- a/tests/expectations/test_rich_click[test simple with rich_config]-click8.config.json +++ b/tests/expectations/test_rich_click[test simple with rich_config]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold", diff --git a/tests/expectations/test_rich_click[test simple]-click8.config.json b/tests/expectations/test_rich_click[test simple]-click8.config.json index bf5e5345..cc6e6f2c 100644 --- a/tests/expectations/test_rich_click[test simple]-click8.config.json +++ b/tests/expectations/test_rich_click[test simple]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold", diff --git a/tests/expectations/test_rich_click[test table styles with rich_config]-click8.config.json b/tests/expectations/test_rich_click[test table styles with rich_config]-click8.config.json index 91ded813..9c612301 100644 --- a/tests/expectations/test_rich_click[test table styles with rich_config]-click8.config.json +++ b/tests/expectations/test_rich_click[test table styles with rich_config]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold", diff --git a/tests/expectations/test_rich_click[test table styles]-click8.config.json b/tests/expectations/test_rich_click[test table styles]-click8.config.json index 91ded813..9c612301 100644 --- a/tests/expectations/test_rich_click[test table styles]-click8.config.json +++ b/tests/expectations/test_rich_click[test table styles]-click8.config.json @@ -7,6 +7,7 @@ "style_metavar_append": "dim yellow", "style_metavar_separator": "dim", "style_header_text": "", + "style_epilog_text": "", "style_footer_text": "", "style_usage": "yellow", "style_usage_command": "bold",