You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
448 B
Python

from typing import Iterable, List, NewType, Optional
CommandArgs = NewType("CommandArgs", List[str])
ShellCommandStr = NewType("ShellCommandStr", str)
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)])