mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-12 20:15:10 +00:00
style(cli): align help output at column 5 and title the dl panel Services
This commit is contained in:
@@ -127,8 +127,15 @@ class Services(click.Group):
|
|||||||
|
|
||||||
remote_services_cache: list[dict] | None = None
|
remote_services_cache: list[dict] | None = None
|
||||||
|
|
||||||
|
def format_help(self, ctx: click.Context, formatter: click.HelpFormatter) -> None:
|
||||||
|
"""Name the commands panel ``Services``, because this group's commands are services."""
|
||||||
|
config = getattr(formatter, "config", None)
|
||||||
|
if config is not None:
|
||||||
|
config.commands_panel_title = "Services"
|
||||||
|
super().format_help(ctx, formatter)
|
||||||
|
|
||||||
def parse_args(self, ctx: click.Context, args: list[str]) -> list[str]:
|
def parse_args(self, ctx: click.Context, args: list[str]) -> list[str]:
|
||||||
"""Preprocess --slow so it can take an optional range value before Click parses args."""
|
"""Preprocess ``--slow`` so it can take an optional range value before Click parses the arguments."""
|
||||||
processed = []
|
processed = []
|
||||||
i = 0
|
i = 0
|
||||||
while i < len(args):
|
while i < len(args):
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ def resolve_palette(name: object) -> dict[str, str] | None:
|
|||||||
|
|
||||||
|
|
||||||
def build_help_config(palette: dict[str, str]) -> RichHelpConfiguration:
|
def build_help_config(palette: dict[str, str]) -> RichHelpConfiguration:
|
||||||
"""Assemble the rich-click help styling for a palette."""
|
"""Assemble the rich-click help configuration for a palette."""
|
||||||
return RichHelpConfiguration(
|
return RichHelpConfiguration(
|
||||||
style_option=palette["text"],
|
style_option=palette["text"],
|
||||||
style_switch=palette["green"],
|
style_switch=palette["green"],
|
||||||
@@ -224,6 +224,13 @@ def build_help_config(palette: dict[str, str]) -> RichHelpConfiguration:
|
|||||||
style_options_table_box="HORIZONTALS",
|
style_options_table_box="HORIZONTALS",
|
||||||
style_options_table_show_lines=True,
|
style_options_table_show_lines=True,
|
||||||
style_options_table_border_style=palette["dark_gray"],
|
style_options_table_border_style=palette["dark_gray"],
|
||||||
|
padding_helptext=(0, 1, 1, 5),
|
||||||
|
padding_usage=(1, 1, 1, 5),
|
||||||
|
style_options_panel_padding=(0, 1, 0, 3),
|
||||||
|
style_commands_panel_padding=(0, 1, 0, 4),
|
||||||
|
panel_title_padding=3,
|
||||||
|
padding_errors_panel=(0, 1, 1, 5),
|
||||||
|
padding_errors_suggestion=(0, 1, 0, 5),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user