Skip to content

Instantly share code, notes, and snippets.

@kristm
Last active May 5, 2016 10:32
Show Gist options
  • Save kristm/ea0c04a4fe80d03d61beb5e1ae51ff92 to your computer and use it in GitHub Desktop.
Save kristm/ea0c04a4fe80d03d61beb5e1ae51ff92 to your computer and use it in GitHub Desktop.
get deploy status in shell
function deps(){
curl $(cat ~/.staging-url) | awk -F '<td>|</td>' '{ if ($2 && $2 !~ /^[0-9]/) print $2 }' |
awk -F '<|>' '{if ($3) { print $3 } else { print $0 }}' |
awk '/^http/ { url=$0 } /^[a-z0-9\/_-]+$/ { branch=$0 }
/ago$/ { gsub(/about /, "");
match($0, /[0-9]+/); time=substr($0, RSTART, RLENGTH);
if($0 ~ /hour/) { mins=time * 60 }
else if ($0 ~ /day/) { mins=time * 60 * 24 }
else if ($0 ~ /month/ || $0 ~ /year/) { mins="48000" }
else if ($0 ~ /less than a minute/) { mins=0 }
else { mins=time };
print url " | " branch " | => " $0 " |("mins")"
}' | column -t -s "="|
awk -F "|" '/qs-video/ { print "\033[45m" $1"\033[95m\033[40m "$2" \033[39m\033[49m"$3 "\033[0m\033[90m\033[40m" $4 "\033[39m"}
/quipper-api/ {print "\033[43m\033[97m" $1"\033[93m\033[40m "$2" \033[39m\033[49m"$3 "\033[0m\033[90m\033[40m" $4 "\033[39m"}
/back-office/ {print "\033[47m\033[30m" $1"\033[1m\033[97m\033[40m "$2" \033[39m\033[49m"$3 "\033[0m\033[90m\033[40m" $4 "\033[39m"}
/qcreate/ {print "\033[0m\033[41m\033[97m" $1"\033[31m\033[40m "$2" \033[39m\033[49m"$3 "\033[0m\033[90m\033[40m" $4 "\033[39m"}
/qlearn/ {print "\033[46m\033[34m" $1"\033[96m\033[40m "$2" \033[39m\033[49m"$3 "\033[0m\033[90m\033[40m" $4 "\033[39m"}
/qlink/ { print "\033[44m" $1"\033[1m\033[34m\033[40m "$2" \033[39m\033[49m"$3 "\033[0m\033[90m\033[40m" $4 "\033[39m"}
/(staff|website|wp|qsupport)/ { print $1" "$2" "$3"\033[0m\033[90m\033[40m" $4 "\033[39m"}'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment