i love this

This commit is contained in:
2019-09-16 00:43:15 -04:00
parent 19828a81b4
commit b2214666f3
4 changed files with 24 additions and 4 deletions
+14 -2
View File
@@ -144,6 +144,8 @@ class TaskScript(BaseAction):
if line.startswith(indent_style):
return line[len(indent_style) :]
return line
def temp_source(self):
tf = mkstemp(suffix=".sh", prefix="bashf-")[1]
@@ -170,17 +172,27 @@ class TaskScript(BaseAction):
script = shlex_quote(f"{tf} {args} 2>&1 | bake-indent")
cmd = f"bash --init-file {shlex_quote(stdlib_path)} -i -c {script}"
return_code = os.system(cmd)
if debug:
click.echo(f"$ {cmd}", err=True)
else:
os.remove(tf)
return os.system(cmd)
return return_code
def shellcheck(self, *, silent=False, debug=False, **kwargs):
tf = self.temp_source()
cmd = f"shellcheck {shlex_quote(tf)} --external-sources --format=json"
c = delegator.run(cmd)
if debug:
click.echo(f"$ {cmd}", err=True)
return delegator.run(cmd)
else:
os.remove(tf)
return c
@property
def name(self):
+5 -2
View File
@@ -2,9 +2,12 @@ test1: test2 test3
source ./
test2: test3
echo '2'
test3:
echo '3'
test3: echo
echo 'hm'
python:
#!/usr/bin/env python
print('wow!')
echo:
echo 'hi, kenneth!'
+5
View File
@@ -11,3 +11,8 @@ def test_first_level_dep(bake):
def test_second_level_dep(bake):
c = bake("needs-needs", fixture="1")
assert "kenneth" in c.out
def test_python_invocation(bake):
c = bake("python", fixture="1")
assert "wow" in c.out
View File