def headerize(text=DASH):
    """
    Add dashes based on terminal length.

    Example:
    ---------------------------------------------------
    text   -->                  Result
    ---------------------------------------------------

    SYSTEM --> ================ SYSTEM ================
    None   --> ========================================

    """

    process = os.popen('stty size', 'r')
    result = process.read()
    process.close()
    terminal_height, terminal_length = result.split()
    if text:
        text_length = len(text)
        remaining_places = int(terminal_length) - text_length
        if remaining_places > 0:
            return DASH * (remaining_places // 2 - 1) + ' ' + text + ' ' + DASH * (remaining_places // 2 - 1)
    else:
        # If there is no text, it returns a line with the length of terminal.
        return DASH * int(terminal_length)
Add dashes based on terminal length.

Example:
---------------------------------------------------
text   -->                  Result
---------------------------------------------------

SYSTEM --> ================ SYSTEM ================
None   --> ========================================
src/jarvis/jarvis/utils/console.py