diff options
Diffstat (limited to 'kvmd/tools.py')
-rw-r--r-- | kvmd/tools.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/kvmd/tools.py b/kvmd/tools.py index 8857796d..d6077938 100644 --- a/kvmd/tools.py +++ b/kvmd/tools.py @@ -73,3 +73,13 @@ def clear_queue(q: multiprocessing.queues.Queue) -> None: # pylint: disable=inv q.get_nowait() except queue.Empty: break + + +# ===== +def build_cmd(cmd: List[str], cmd_remove: List[str], cmd_append: List[str]) -> List[str]: + assert len(cmd) >= 1, cmd + return [ + cmd[0], # Executable + *filter((lambda item: item not in cmd_remove), cmd[1:]), + *cmd_append, + ] |