Skip to content

Console Helper module

The console helper module provides functions for printing colored messages to the console.

Raises:

Type Description
Exception

If the message is not defined.

print_green(msg)

Print the message in green.

Parameters:

Name Type Description Default
msg str

The message to be printed to STDOUT.

required

Raises:

Type Description
Exception

If the message is not defined.

Source code in jira_python_utils/console_helper.py
def print_green(msg: str) -> None:
    """Print the message in green.

    Args:
        msg (str): The message to be printed to STDOUT.

    Raises:
        Exception: If the message is not defined.
    """
    if msg is None or msg == "":
        raise Exception("msg was not defined")

    console.print(f"[bold green]{msg}[/]")

print_red(msg)

Print the message in red.

Parameters:

Name Type Description Default
msg str

The message to be printed to STDERR.

required

Raises:

Type Description
Exception

If the message is not defined.

Source code in jira_python_utils/console_helper.py
def print_red(msg: str) -> None:
    """Print the message in red.

    Args:
        msg (str): The message to be printed to STDERR.

    Raises:
        Exception: If the message is not defined.
    """
    if msg is None or msg == "":
        raise Exception("msg was not defined")
    error_console.print(msg)

print_yellow(msg=None)

Print the message in yellow.

Parameters:

Name Type Description Default
msg str

The message to be printed to STDOUT.

None

Raises:

Type Description
Exception

If the message is not defined.

Source code in jira_python_utils/console_helper.py
def print_yellow(msg: str = None) -> None:
    """Print the message in yellow.

    Args:
        msg (str): The message to be printed to STDOUT.

    Raises:
        Exception: If the message is not defined.
    """
    if msg is None or msg == "":
        raise Exception("msg was not defined")

    console.print(f"[bold yellow]{msg}[/]")