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} "
|
return f" {command_keys_text:<20} {options_text} "
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def help_signature(self) -> tuple[Panel, str]:
|
def help_signature(self) -> tuple[Padding, str]:
|
||||||
"""Generate a help signature for the command."""
|
"""Generate a help signature for the command."""
|
||||||
is_cli_mode = self.options_manager.get("mode") in {
|
is_cli_mode = self.options_manager.get("mode") in {
|
||||||
FalyxMode.RUN,
|
FalyxMode.RUN,
|
||||||
@ -362,11 +362,14 @@ class Command(BaseModel):
|
|||||||
program = f"{self.program} run " if is_cli_mode else ""
|
program = f"{self.program} run " if is_cli_mode else ""
|
||||||
|
|
||||||
if self.arg_parser and not self.simple_help_signature:
|
if self.arg_parser and not self.simple_help_signature:
|
||||||
usage = Panel(
|
usage = Padding(
|
||||||
|
Panel(
|
||||||
f"[{self.style}]{program}[/]{self.arg_parser.get_usage()}",
|
f"[{self.style}]{program}[/]{self.arg_parser.get_usage()}",
|
||||||
expand=False,
|
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:
|
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)
|
return usage, "\n".join(description)
|
||||||
@ -376,10 +379,13 @@ class Command(BaseModel):
|
|||||||
+ [f"[{self.style}]{alias}[/{self.style}]" for alias in self.aliases]
|
+ [f"[{self.style}]{alias}[/{self.style}]" for alias in self.aliases]
|
||||||
)
|
)
|
||||||
return (
|
return (
|
||||||
|
Padding(
|
||||||
Panel(
|
Panel(
|
||||||
f"[{self.style}]{program}[/]{command_keys} {self.description}",
|
f"[{self.style}]{program}[/]{command_keys} {self.description}",
|
||||||
expand=False,
|
expand=False,
|
||||||
),
|
),
|
||||||
|
(0, 2),
|
||||||
|
),
|
||||||
"",
|
"",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -366,6 +366,7 @@ class Falyx:
|
|||||||
return choice(tips)
|
return choice(tips)
|
||||||
|
|
||||||
async def _show_help(self, tag: str = "") -> None:
|
async def _show_help(self, tag: str = "") -> None:
|
||||||
|
self.console.print("[bold]help:[/bold]")
|
||||||
if tag:
|
if tag:
|
||||||
tag_lower = tag.lower()
|
tag_lower = tag.lower()
|
||||||
commands = [
|
commands = [
|
||||||
|
@ -1 +1 @@
|
|||||||
__version__ = "0.1.74"
|
__version__ = "0.1.75"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "falyx"
|
name = "falyx"
|
||||||
version = "0.1.74"
|
version = "0.1.75"
|
||||||
description = "Reliable and introspectable async CLI action framework."
|
description = "Reliable and introspectable async CLI action framework."
|
||||||
authors = ["Roland Thomas Jr <roland@rtj.dev>"]
|
authors = ["Roland Thomas Jr <roland@rtj.dev>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
Reference in New Issue
Block a user