Created
July 12, 2016 14:50
-
-
Save jcderr/5e132102b4b62b06694e277ce58a9863 to your computer and use it in GitHub Desktop.
(W)ait (U)ntil (AMI) (D)one
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
#!/bin/zsh | |
autoload colors | |
if [[ "$terminfo[colors]" -gt 8 ]]; then | |
colors | |
fi | |
for COLOR in RED GREEN YELLOW BLUE MAGENTA CYAN BLACK WHITE; do | |
eval ${COLOR}='$fg_no_bold[${(L)COLOR}]' | |
eval BOLD_${COLOR}='$fg_bold[${(L)COLOR}]' | |
done | |
function info() { | |
echo "${CYAN}[INFO] ${1}${RESET}" | |
} | |
eval RESET='$reset_color' | |
IMGID=$1 | |
local spinstr='|/-\' | |
local delay=0.75 | |
while [ "$(aws ec2 describe-images --image-ids $IMGID --query 'Images[].State' --output text 2> /dev/null | grep -v available)" ]; do | |
local temp=${spinstr#?} | |
printf " [%c] " "$spinstr" | |
local spinstr=$temp${spinstr%"$temp"} | |
sleep $delay | |
printf "\b\b\b\b\b\b" | |
done | |
info " _______ ______ .__ __. _______" | |
info "| \\ / __ \\ | \\ | | | ____|" | |
info "| .--. | | | | | \\| | | |__ " | |
info "| | | | | | | | . \` | | __| " | |
info "| '--' | \`--' | | |\\ | | |____ " | |
info "|_______/ \\______/ |__| \\__| |_______|" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment