Created
May 24, 2017 02:38
-
-
Save YerkoPalma/c9814be639efb165e8445667f36b901e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
bold=$(tput bold) | |
normal=$(tput sgr0) | |
# if there is not TEMPLATE folder | |
if [ -z "$TEMPLATES" ]; then | |
printf "%sbin/savior:%s TEMPLATES variable not set\n" "$bold" "$normal" | |
exit 1 | |
fi | |
# if there is no template specified | |
if [ $# = "0" ]; then | |
printf "%susage:%s savior <template_name>\n" "$bold" "$normal" | |
exit 1 | |
fi | |
# set the current template | |
template="$TEMPLATES/$1/main" | |
# if the main file of the template is not executable or doesn't exists | |
if [ ! -x "$template" ]; then | |
printf '%sbin/savior:%s template %s does not exist\n' "$bold" "$normal" "$1" | |
exit 1 | |
fi | |
shift | |
"$template" "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment