Last active
May 16, 2016 18:36
-
-
Save ezekg/0c4fe0f3cf467ad3fcfb246c301125c2 to your computer and use it in GitHub Desktop.
Simple bash task runner
This file contains hidden or 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
#!/usr/bin/env bash | |
# Run a task | |
# | |
# @param $1 - Task name | |
# @param $2 - Command to run | |
function task() { | |
printf "\033[00;34m%-50s\033[0m" "$1 ..." | |
eval "$2" && success || fail | |
} | |
# Print success message | |
function success { | |
echo -e "\033[00;32m[ OK ]\033[0m" | |
} | |
# Print failure message | |
function fail { | |
echo -e "\033[00;31m[ FAIL ]\033[0m" | |
} | |
# Tasks | |
task "Creating asset folder" "mkdir -p www/public/assets > /dev/null 2>&1" | |
task "Copying assets" "cp -R src/assets/* www/public/assets/ > /dev/null 2>&1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment