Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 6cd917d4 authored by LEPAGE Gaetan's avatar LEPAGE Gaetan
Browse files

Better colors in CLI

parent d48f5404
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,7 @@ from os.path import join ...@@ -9,6 +9,7 @@ from os.path import join
from socket import gethostname from socket import gethostname
from subprocess import Popen, DEVNULL from subprocess import Popen, DEVNULL
from typing import Union from typing import Union
from termcolor import colored
from .config import Config from .config import Config
from .user_interaction import to_bold, print_info, print_error from .user_interaction import to_bold, print_info, print_error
...@@ -33,7 +34,7 @@ def run_local_cmd(command: list[str], ...@@ -33,7 +34,7 @@ def run_local_cmd(command: list[str],
running command. (if background) running command. (if background)
return_code (int): Else, the return code of the command. return_code (int): Else, the return code of the command.
""" """
print_info(to_bold('Running command locally: ') + ' '.join(command)) print_info(to_bold('Running command locally: ') + colored(' '.join(command), 'blue'))
if redirect_output: if redirect_output:
log_file: str = join(Config().output_path, 'log.txt') log_file: str = join(Config().output_path, 'log.txt')
...@@ -137,11 +138,12 @@ def run_remote_command(command: list[str], ...@@ -137,11 +138,12 @@ def run_remote_command(command: list[str],
cmd += command cmd += command
print_info(to_bold('Running command: `') + ' '.join(command) + '`') print_info(to_bold('Running command: ')
+ colored(' '.join(command), 'blue'))
if pretty_hostname is None: if pretty_hostname is None:
pretty_hostname = hostname[-1] if isinstance(hostname, list) else hostname pretty_hostname = hostname[-1] if isinstance(hostname, list) else hostname
print_info(to_bold('on remote host: ') + str(pretty_hostname)) print_info(to_bold('on remote host: ') + colored(str(pretty_hostname), 'magenta'))
if redirect_output: if redirect_output:
log_file: str = join(config.output_path, 'log.txt') log_file: str = join(config.output_path, 'log.txt')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment