import subprocess

def print_title(title):
    decorator = '-' * len(title)
    print(f"{decorator}\n{title}\n{decorator}")

def print_error(message):
    print(f'\033[0;31m{message}\033[0;m')

def print_success(message):
    print(f'\033[0;32m{message}\033[0;m')
    
def show_menu(options):
    print_title('Select an option:')
    for key in options:
        print(f' {key}) {options[key][0]}')

def read_option(options):
    while (a := input('Option: ')) not in options:
        print('Incorrect option, try again.')
    return a

def run_sub_process(command):
    sup_process = subprocess.run(command, shell=True, check=True, capture_output=True, encoding='utf-8')
    return sup_process.stdout

def run_sub_process_without_output(command):
    subprocess.run(command, shell=True, check=True, encoding='utf-8')
