mirror of
https://github.com/daylinmorgan/task.mk.git
synced 2024-11-09 19:13:14 -06:00
feat: general script runner to include bash as well
This commit is contained in:
parent
3f32756fb4
commit
65af033efa
3 changed files with 22 additions and 3 deletions
11
Makefile
11
Makefile
|
@ -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}
|
||||
|
|
|
@ -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
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#% include 'builtins.mk' %#
|
||||
|
||||
#% include 'py-runner.mk' %#
|
||||
#% include 'runners.mk' %#
|
||||
|
||||
# ---- [python scripts] ---- #
|
||||
|
||||
|
|
Loading…
Reference in a new issue