feat: add presets
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
__all__ = (
|
||||
"CommandError",
|
||||
"Command",
|
||||
"CommandExecutor",
|
||||
)
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import logging
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
logger = logging.getLogger(">")
|
||||
logger = logging.getLogger("command")
|
||||
|
||||
|
||||
class CommandError(RuntimeError):
|
||||
@@ -17,18 +17,16 @@ class CommandError(RuntimeError):
|
||||
return self.args[0].decode("utf-8").strip()
|
||||
|
||||
|
||||
class Command:
|
||||
class CommandExecutor:
|
||||
_logger = logger
|
||||
|
||||
def __init__(self, executor: str, *args: str) -> None:
|
||||
self._executor = executor
|
||||
self._args = args
|
||||
def __init__(self, command: str) -> None:
|
||||
self._command = command
|
||||
|
||||
def run(self, basepath: Path):
|
||||
args = [self._executor, *self._args]
|
||||
self._logger.debug(" ".join(args))
|
||||
self._logger.debug(self._command)
|
||||
result = subprocess.run(
|
||||
args,
|
||||
self._command.split(" "),
|
||||
cwd=basepath,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
|
||||
Reference in New Issue
Block a user