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:
2025-07-26 18:07:31 -04:00
parent 7836ff4dfd
commit da38f6d6ee
4 changed files with 18 additions and 11 deletions

View File

@ -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,13 +362,16 @@ 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(
f"[{self.style}]{program}[/]{self.arg_parser.get_usage()}", Panel(
expand=False, 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: 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)
command_keys = " | ".join( command_keys = " | ".join(
@ -376,9 +379,12 @@ 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 (
Panel( Padding(
f"[{self.style}]{program}[/]{command_keys} {self.description}", Panel(
expand=False, f"[{self.style}]{program}[/]{command_keys} {self.description}",
expand=False,
),
(0, 2),
), ),
"", "",
) )

View File

@ -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 = [

View File

@ -1 +1 @@
__version__ = "0.1.74" __version__ = "0.1.75"

View File

@ -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"