Skip to content
Snippets Groups Projects
Commit a034e5c6 authored by Christopher Spinrath's avatar Christopher Spinrath
Browse files

Support flags for tasks which depend on (the presence of) a variable

parent 4e71f506
No related branches found
No related tags found
No related merge requests found
...@@ -75,8 +75,22 @@ class Task: ...@@ -75,8 +75,22 @@ class Task:
return self._work_dir return self._work_dir
def run(self, variables): def run(self, variables):
parameters = [p.format(**variables) for p in self._parameters] args = [self._base_command]
args = [self._base_command] + parameters
for p in self._parameters:
if not isinstance(p, dict):
args.append(p.format(**variables))
continue
assert "value" in p, "An extended paramter has to contain a value field"
if "if-variable" in p:
v = p["if-variable"]
if v not in variables.keys() or (isinstance(variables[v], bool) and not variables[v]):
continue # skip
args.append(p["value"].format(**variables))
# print() # print()
# print(f"pushd {self._work_dir}") # print(f"pushd {self._work_dir}")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment