harbor_cli.output.console
Attributes
console = Console()
module-attribute
err_console = Console(stderr=True, highlight=False, soft_wrap=True)
module-attribute
Classes
Functions
get_renderable(message: str, icon: Icon | str, color: Color, preamble: str | None = None, color_all: bool = False, bold: bool = False, panel: bool = False, rule: bool = False) -> Group
Constructs a renderable object for printing to the console.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message |
str
|
Message to print. |
required |
icon |
Icon
|
Icon to use. |
required |
color |
Color
|
Color to use for the icon. |
required |
preamble |
str
|
Preamble to print before the message, by default None Trailing colon and whitespace are removed. |
None
|
color_all |
bool
|
Whether to color the entire message, by default False Only colors the icon if False. |
False
|
bold |
bool
|
Whether to bold the message, by default False |
False
|
panel |
bool
|
Whether to wrap the message in a panel, by default False |
False
|
rule |
bool
|
Whether to print a rule (line) before the message, by default False |
False
|
Returns:
Type | Description |
---|---|
Group
|
A group of renderables to print. |
Source code in harbor_cli/output/console.py
info(message: str, panel: bool = False, rule: bool = False, **kwargs: Any) -> None
Log with INFO level and print an informational message.
Source code in harbor_cli/output/console.py
success(message: str, panel: bool = False, rule: bool = False, **kwargs: Any) -> None
Log with DEBUG level and print a success message.
Source code in harbor_cli/output/console.py
warning(message: str, rule: bool = False, panel: bool = False, **kwargs: Any) -> None
Log with WARNING level and optionally print a warning message.
Source code in harbor_cli/output/console.py
error(message: str, rule: bool = False, panel: bool = False, exc_info: bool = False, **kwargs: Any) -> None
Log with ERROR level and print an error message.
Source code in harbor_cli/output/console.py
exit_ok(message: Optional[str] = None, code: int = 0, **kwargs: Any) -> NoReturn
Logs a message with INFO level and exits with the given code (default: 0)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message |
str
|
Message to print. |
None
|
code |
int
|
Exit code, by default 0 |
0
|
**kwargs |
Any
|
Additional keyword arguments to pass to the extra dict. |
{}
|
Source code in harbor_cli/output/console.py
exit_err(message: str, code: int = 1, **kwargs: Any) -> NoReturn
Logs a message with ERROR level and exits with the given code (default: 1).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message |
str
|
Message to print. |
required |
code |
int
|
Exit code, by default 1 |
1
|
**kwargs |
Any
|
Additional keyword arguments to pass to the extra dict. |
{}
|
Source code in harbor_cli/output/console.py
print_toml(toml_str: str, end: str = '\n') -> None
Prints TOML to stdout using the default console.