style(help): improve help display layout and styling for consistency
- Wrapped help signatures in `Padding` for better visual spacing. - Updated descriptions and tags to use dimmed text with indentation for clarity. - Added a bold "help:" header to `_show_help()` for clearer section labeling. - Bumped version to 0.1.75.
This commit is contained in:
@ -351,7 +351,7 @@ class Command(BaseModel):
|
||||
return f" {command_keys_text:<20} {options_text} "
|
||||
|
||||
@property
|
||||
def help_signature(self) -> tuple[Panel, str]:
|
||||
def help_signature(self) -> tuple[Padding, str]:
|
||||
"""Generate a help signature for the command."""
|
||||
is_cli_mode = self.options_manager.get("mode") in {
|
||||
FalyxMode.RUN,
|
||||
@ -362,13 +362,16 @@ class Command(BaseModel):
|
||||
program = f"{self.program} run " if is_cli_mode else ""
|
||||
|
||||
if self.arg_parser and not self.simple_help_signature:
|
||||
usage = Panel(
|
||||
f"[{self.style}]{program}[/]{self.arg_parser.get_usage()}",
|
||||
expand=False,
|
||||
usage = Padding(
|
||||
Panel(
|
||||
f"[{self.style}]{program}[/]{self.arg_parser.get_usage()}",
|
||||
expand=False,
|
||||
),
|
||||
(0, 2),
|
||||
)
|
||||
description = [f" {self.help_text or self.description}"]
|
||||
description = [f" [dim]{self.help_text or self.description}[/dim]"]
|
||||
if self.tags:
|
||||
description.append(f" [dim]Tags: {', '.join(self.tags)}[/dim]")
|
||||
description.append(f" [dim]Tags: {', '.join(self.tags)}[/dim]")
|
||||
return usage, "\n".join(description)
|
||||
|
||||
command_keys = " | ".join(
|
||||
@ -376,9 +379,12 @@ class Command(BaseModel):
|
||||
+ [f"[{self.style}]{alias}[/{self.style}]" for alias in self.aliases]
|
||||
)
|
||||
return (
|
||||
Panel(
|
||||
f"[{self.style}]{program}[/]{command_keys} {self.description}",
|
||||
expand=False,
|
||||
Padding(
|
||||
Panel(
|
||||
f"[{self.style}]{program}[/]{command_keys} {self.description}",
|
||||
expand=False,
|
||||
),
|
||||
(0, 2),
|
||||
),
|
||||
"",
|
||||
)
|
||||
|
@ -366,6 +366,7 @@ class Falyx:
|
||||
return choice(tips)
|
||||
|
||||
async def _show_help(self, tag: str = "") -> None:
|
||||
self.console.print("[bold]help:[/bold]")
|
||||
if tag:
|
||||
tag_lower = tag.lower()
|
||||
commands = [
|
||||
|
@ -1 +1 @@
|
||||
__version__ = "0.1.74"
|
||||
__version__ = "0.1.75"
|
||||
|
@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "falyx"
|
||||
version = "0.1.74"
|
||||
version = "0.1.75"
|
||||
description = "Reliable and introspectable async CLI action framework."
|
||||
authors = ["Roland Thomas Jr <roland@rtj.dev>"]
|
||||
license = "MIT"
|
||||
|
Reference in New Issue
Block a user