Skip to content

Instantly share code, notes, and snippets.

@klebervirgilio
Created January 13, 2015 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klebervirgilio/ddb1c50cb5628dc7050f to your computer and use it in GitHub Desktop.
Save klebervirgilio/ddb1c50cb5628dc7050f to your computer and use it in GitHub Desktop.
autoload -U colors && colors
HOUR=`date +"%k"`
function _is_current_ () {
if [[ $1 =~ ([0-9]{1,2})h([[:space:]]-[[:space:]])?([0-9]{1,2})?h? ]]; then
start=$match[1];
end=$match[3];
if [ -z $end ]; then
if [[ $HOUR -eq $start ]]; then
echo "$bg[blue]$1";
else
echo $1;
fi
elif [ $HOUR -ge $start ] && [ $HOUR -le $end ]; then
echo "$bg[blue]$1";
else
echo $1;
fi
fi
}
function _format_ () {
echo $1 | while read a; do _is_current_ $a; done;
}
MON="
Trabalhar $fg[green]6h - 11h$reset_color
Academia $fg[green]11h - 14h$reset_color
Trabalhar $fg[green]15h - 18h$reset_color
Domir até as $fg[green]19h$reset_color
English $fg[green]19h - 20h$reset_color
Skate $fg[green]20h - 22h$reset_color
Read a book $fg[green]23h$reset_color"
TUE="
Correr $fg[green]6h - 7h$reset_color
Trabalhar $fg[green]8h - 16h$reset_color
Skate $fg[green]17h - 19h$reset_color
IDE $fg[green]20h - 22h$reset_color
Read a book $fg[green]23h$reset_color"
WED="
Trabalhar $fg[green]6h - 11h$reset_color
Academia $fg[green]11h - 14h$reset_color
Trabalhar $fg[green]15h - 18h$reset_color
Domir até as $fg[green]19h$reset_color
English $fg[green]19h - 21h$reset_color
Read a book $fg[green]23h$reset_color"
THU="
Correr $fg[green]6h - 7h$reset_color
Trabalhar $fg[green]8h - 16h$reset_color
Domir até as $fg[green]17h$reset_color
Cousera Class $fg[green]18h - 20h$reset_color
Skate $fg[green]20h - 22h$reset_color
Read a book $fg[green]23h$reset_color"
FRI="
Trabalhar $fg[green]6h - 11h$reset_color
Academia $fg[green]11h - 14h$reset_color
Trabalhar $fg[green]15h - 18h$reset_color
Domir até as $fg[green]19h$reset_color
Cousera Class $fg[green]20h - 22h$reset_color
Read a book $fg[green]23h$reset_color"
function TODOday () {
case $(date +"%u") in
"1") _format_ $MON ;;
"2") _format_ $TUE ;;
"3") _format_ $WED ;;
"4") _format_ $THU ;;
"5") _format_ $FRI ;;
esac
}
TODOday
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment