Skip to content

Instantly share code, notes, and snippets.

@mktcode
Last active November 9, 2023 19:22
Show Gist options
  • Save mktcode/d055e558b644241a40ee9d7b1b943689 to your computer and use it in GitHub Desktop.
Save mktcode/d055e558b644241a40ee9d7b1b943689 to your computer and use it in GitHub Desktop.
A very simple time tracking tool for the command line.
# Time Tracking Tool
####################
# Simply writes dates/times/comments in a file.
# Each week has it's own file (e.g. ~/.ttt/2019-01.txt).
#
# ttt <comment>: add entry to current week's file
# tttt: output current week's file content with cat
# ttte: edit current week's file with vim
# tttp: pause
ttt() {
mkdir -p ~/.ttt
file="/home/$USER/.ttt/$(date +"%Y-%W").txt"
echo `date '+%Y-%m-%d %H:%M'`" | "$* >> $file
printf "Added time tracking entry:\n"
tail -1 $file
}
alias tttt='cat ~/.ttt/$(date +"%Y-%W").txt'
alias ttte='vim ~/.ttt/$(date +"%Y-%W").txt'
alias tttp='ttt pause'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment