feat: general script runner to include bash as well

This commit is contained in:
Daylin Morgan 2022-09-05 18:11:37 -05:00
parent 3f32756fb4
commit 65af033efa
3 changed files with 22 additions and 3 deletions

View file

@ -58,6 +58,17 @@ version-check:
$(call tprint-sh,{a.green}VERSION LOOKS GOOD!{a.end});\
fi
define bash_script
echo "This is from bash"
cat /etc/hostname
printf "%s\n" "$(2)"
endef
.PHONY: test-bash
test-bash:
$(call tbash,bash_script,test bash multiline)
define msg
{a.b_yellow}
It can even be multiline!{a.end}

View file

@ -1,4 +1,4 @@
# ---- [python script runner] ---- #
# ---- [python/bash script runner] ---- #
# modified from https://unix.stackexchange.com/a/223093
define \n
@ -21,8 +21,16 @@ define py
@printf -- "----------------\n"
@printf "$(call create_string,$($(1)))" | python3
endef
define tbash
@printf "Bash Script:\n"
@printf -- "----------------\n"
@printf "$(call create_string,$($(1)))\n"
@printf -- "----------------\n"
@printf "$(call create_string,$($(1)))" | bash
endef
else
py = @printf "$(call create_string,$($(1)))" | python3
tbash = @printf "$(call create_string,$($(1)))" | bash
endif
pysh = printf "$(call create_string,$($(1)))" | python3

View file

@ -4,7 +4,7 @@
#% include 'builtins.mk' %#
#% include 'py-runner.mk' %#
#% include 'runners.mk' %#
# ---- [python scripts] ---- #