Terminal UI utilities for the CLI.
This module provides rich formatting for terminal output.
Functions:
Functions
command_header(group_name: str, command_name: str) -> None
Print a header for a command.
Source code in tux/cli/ui.py
Pythondef command_header(group_name: str, command_name: str) -> None:
"""Print a header for a command."""
text = Text()
text.append("Running ", style="dim")
text.append(f"{group_name}", style=INFO_STYLE)
text.append(":")
text.append(f"{command_name}", style=SUCCESS_STYLE)
console.print(text)
command_result(is_success: bool, message: str = '') -> None
Print the result of a command.
Source code in tux/cli/ui.py
Pythondef command_result(is_success: bool, message: str = "") -> None:
"""Print the result of a command."""
if is_success:
if message:
success(message)
else:
success("Command completed successfully")
elif message:
error(message)
else:
error("Command failed")
create_table(title: str, columns: list[str]) -> Table
Create a rich table with the given title and columns.
Source code in tux/cli/ui.py
Pythondef create_table(title: str, columns: list[str]) -> Table:
"""Create a rich table with the given title and columns."""
table = Table(title=title)
for column in columns:
table.add_column(column)
return table