-
-
Save vasileboris/a9cbe3acfbf6d5995310be9d7bf5e120 to your computer and use it in GitHub Desktop.
Calypso AnyBar handler
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 | |
PORT="${PORT:-1738}" | |
INITIAL_COLOR="${INITIAL_COLOR:-"white"}" | |
PROGRESS_COLOR="${PROGRESS_COLOR:-"yellow"}" | |
DONE_COLOR="${DONE_COLOR:-"green"}" | |
BUILD_ERROR_COLOR="${BUILD_ERROR_COLOR:-"red"}" | |
main() { | |
reset_icon | |
tee >(update_status) | |
} | |
update_status() { | |
while read line | |
do | |
if [[ "$line" =~ "Rendering Complete, saving .css file..." ]]; then | |
set_icon "$PROGRESS_COLOR" | |
elif [[ "$line" =~ "Getting bundles ready, hold on..." ]]; then | |
set_icon "$PROGRESS_COLOR" | |
elif [[ "$line" =~ ": Compiling..." ]]; then | |
set_icon "$PROGRESS_COLOR" | |
elif [[ "$line" =~ ": Compiled successfully." ]]; then | |
set_icon "$DONE_COLOR" | |
elif [[ "$line" =~ ": Failed to compile." ]]; then | |
set_icon "$BUILD_ERROR_COLOR" | |
fi | |
done | |
} | |
set_icon() { | |
echo -n "$1" | nc -4u -w0 localhost $PORT | |
} | |
reset_icon() { | |
set_icon "$INITIAL_COLOR" | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment