Created
June 21, 2009 03:18
-
-
Save mivok/133375 to your computer and use it in GitHub Desktop.
Color hilighting for todo.sh
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/bash | |
COLOR_CONTEXT=$GREEN | |
COLOR_PROJECT=$RED | |
COLOR_DATE=$LIGHT_GREEN | |
# Force gawk to behave posixly. Comment out if you get an error about | |
# no such option -W. | |
AWK_OPTIONS="-W posix" | |
if [ "$TODOTXT_PLAIN" -eq "0" ]; then | |
awk $AWK_OPTIONS " | |
{ color = \"$DEFAULT\" } | |
/\(A\)/ { color = \"$PRI_A\" } | |
/\(B\)/ { color = \"$PRI_B\" } | |
/\(C\)/ { color = \"$PRI_C\" } | |
/\([D-Z]\)/ { color = \"$PRI_X\" } | |
{ | |
gsub(/@[^ ]*/, \"$COLOR_CONTEXT&\" color); | |
gsub(/\+[^ ]*/, \"$COLOR_PROJECT&\" color); | |
sub(/[0-9]{4}(-[0-9]{2}){2}/, \"$COLOR_DATE&\" color); | |
} | |
" | |
else | |
cat | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment