Add helpers filter_cmds and combine_cmds

main
Felix Stupp 2 years ago
parent 308eb70900
commit 79fca1994c
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -32,6 +32,7 @@ import shlex
import sys
from typing import (
Dict,
Iterable,
List,
Mapping,
NewType,
@ -122,6 +123,14 @@ PODMAN_COMPOSE_EXEC = CommandArgs(
# === helpers
def filter_cmds(command: Iterable[Optional[str]]) -> CommandArgs:
return CommandArgs([arg for arg in command if arg is not None])
def combine_cmds(*commands: CommandArgs | List[Optional[str]]) -> CommandArgs:
return CommandArgs([arg for cmd in commands for arg in filter_cmds(cmd)])
@wraps(print)
def error(*args, **kwargs):
ret = print(*args, file=sys.stderr, **kwargs)

Loading…
Cancel
Save