clan-cli: Refactor colors to a subset of colors that work in light and dark mode

This commit is contained in:
Qubasa
2024-11-27 12:42:10 +01:00
parent 29dc5d679e
commit a1a367c57c
10 changed files with 245 additions and 388 deletions

View File

@@ -10,7 +10,7 @@ from pathlib import Path
from shlex import quote
from typing import IO, Any
from clan_cli.cmd import Log
from clan_cli.cmd import Log, MsgColor
from clan_cli.cmd import run as local_run
from clan_cli.ssh.host_key import HostKeyCheck
@@ -68,6 +68,7 @@ class Host:
check: bool = True,
error_msg: str | None = None,
needs_user_terminal: bool = False,
msg_color: MsgColor | None = None,
shell: bool = False,
timeout: float = math.inf,
) -> subprocess.CompletedProcess[str]:
@@ -85,6 +86,7 @@ class Host:
logger=cmdlog,
check=check,
error_msg=error_msg,
msg_color=msg_color,
needs_user_terminal=needs_user_terminal,
)
return subprocess.CompletedProcess(
@@ -141,6 +143,7 @@ class Host:
timeout: float = math.inf,
verbose_ssh: bool = False,
tty: bool = False,
msg_color: MsgColor | None = None,
shell: bool = False,
log: Log = Log.BOTH,
) -> subprocess.CompletedProcess[str]:
@@ -192,6 +195,7 @@ class Host:
cwd=cwd,
check=check,
timeout=timeout,
msg_color=msg_color,
needs_user_terminal=True, # ssh asks for a password
)

View File

@@ -116,7 +116,7 @@ class HostGroup:
errors += 1
if errors > 0:
msg = f"{errors} hosts failed with an error. Check the logs above"
raise ClanError(msg)
raise ClanError(msg) from e
def _run(
self,