utils.echo

module utils.echo


class Echo

Helper class to use when printing output of the CLI.

Provides utilities to print different levels of the messages and provides formatting capabilities to each of the levels.

method __init__

__init__(debug: Optional[bool] = False)None

method debug

debug(message: str)None

Format and echo a debug message

Args:

  • message (str): debug message to format and echo


method echo

echo(message: str, formatted: str)None

Main function to print information of a message, original message is provided as well as the formatted one. Original is used when formatting is not possible.

Args:

  • message (str): original message

  • formatted (str): formatted message


method error

error(message: str)None

Format and echo an error message

Args:

  • message (str): error message to format and echo


method format_debug

format_debug(message: str)str

Specific format for debug purposes

Args:

  • message (str): message to format

Returns:

  • str: debug formatted message


method format_error

format_error(message: str)str

Specific format for error purposes

Args:

  • message (str): message to format

Returns:

  • str: error formatted message


method format_message

format_message(message: str, field: str = 'giza', color: str = 'orange3')str

Format a message with an specific field and color. Adds current time, provided field and prints it with the specified color.

Args:

  • message (str): the message to format with the CLI

  • field (str): Main field to format with the message. Defaults to "giza".

  • color (str): Color to format the message with. Defaults to "orange3".

Returns:

  • str: the formatted message


method format_warning

format_warning(message: str)str

Specific format for warning purposes

Args:

  • message (str): message to format

Returns:

  • str: error formatted message


method info

info(message: str)None

Format and echo a message

Args:

  • message (str): message to format and echo


method warning

warning(message: str)None

Format and echo a warning message

Args:

  • message (str): message to format and echo

Last updated