Skip to content

Instantly share code, notes, and snippets.

@craigeley
Created December 2, 2015 02:15
Show Gist options
  • Save craigeley/57d48dca08477d80ba94 to your computer and use it in GitHub Desktop.
Save craigeley/57d48dca08477d80ba94 to your computer and use it in GitHub Desktop.
A script that shows elapsed time of the current `doing` task in TextBar. Change the path to your doing in line 5.
if [[ `/usr/local/bin/doing last` == *"@done"* ]]; then
echo "💬";
else
name=`/usr/local/bin/doing last | sed 's/@.*//g'`;
start=`grep -o -m 1 "\d*-\d*-\d*\s\d*:\d*\s" /path/to/what_was_i_doing.md`;
date1=`date -j -f '%Y-%m-%d %H:%M ' "$start" +"%s"`;
now=`date -j +"%s"`;
diff=$(($now-$date1));
echo "$name 🕗$(printf "%02d" $(($diff / 3600))):$(printf "%02d" $((($diff / 60) % 60)))"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment