diff options
author | Maxim Devaev <[email protected]> | 2022-06-19 20:42:52 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2022-06-19 20:47:17 +0300 |
commit | 0edf854832a85c68d09125a0ef1491a093c78d99 (patch) | |
tree | fa43983005c801c4a2a323418d2c46accb4b4eab /kvmd/tools.py | |
parent | 4aa7a21b5597af3171ff5b7217fe4e6bb3ab5db9 (diff) |
cmdfmt
Diffstat (limited to 'kvmd/tools.py')
-rw-r--r-- | kvmd/tools.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/kvmd/tools.py b/kvmd/tools.py index 7af6723c..77a81d64 100644 --- a/kvmd/tools.py +++ b/kvmd/tools.py @@ -24,6 +24,7 @@ import operator import functools import multiprocessing.queues import queue +import shlex from typing import Tuple from typing import List @@ -38,6 +39,10 @@ def remap(value: int, in_min: int, in_max: int, out_min: int, out_max: int) -> i # ===== +def cmdfmt(cmd: List[str]) -> str: + return " ".join(map(shlex.quote, cmd)) + + def efmt(err: Exception) -> str: return f"{type(err).__name__}: {err}" |