aboutsummaryrefslogtreecommitdiffstats
path: root/taskipy/run.py
diff options
context:
space:
mode:
authorRoy Sommer <illBeRoy@users.noreply.github.com>2020-01-02 19:25:03 +0200
committerGitHub <noreply@github.com>2020-01-02 19:25:03 +0200
commit81b17bde80cff6765f9c419965ea93d80814614f (patch)
treec63f4ee8a615bafbb735820388993cfa4635159d /taskipy/run.py
parentupdated pytoml (diff)
parentadded support for passing arguments into taskipy tasks (diff)
downloadtaskipy2-81b17bde80cff6765f9c419965ea93d80814614f.zip
Merge pull request #2 from illBeRoy/pass-arguments-to-task
Support Passing Command Line Arguments Into Tasks
Diffstat (limited to 'taskipy/run.py')
-rw-r--r--taskipy/run.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/taskipy/run.py b/taskipy/run.py
index b8ae4ab..ff2db44 100644
--- a/taskipy/run.py
+++ b/taskipy/run.py
@@ -5,7 +5,7 @@ import toml
from os import path
from typing import List
-def run_task(task_name: str, cwd=os.curdir):
+def run_task(task_name: str, args: List[str], cwd=os.curdir):
def run_commands_and_bail_on_first_fail(cmds: List[str]) -> int:
for cmd in cmds:
p = subprocess.Popen(cmd, shell=True, cwd=cwd)
@@ -34,7 +34,8 @@ def run_task(task_name: str, cwd=os.curdir):
try:
task = tasks[task_name]
- commands.append(task)
+ command_with_passed_args = ' '.join([task] + args)
+ commands.append(command_with_passed_args)
except:
print(f'could not find task "{task_name}""')
sys.exit(127)