fin - command line TODO list, made with ❤

I recently read a couple hackernews comments about using plain text files and folders for task management. Decided to write a command line TODO list program built on this concept. It’s intended to be minimalist, extensible, and reasonably future proof. I’m aiming to be simpler than todo.txt or taskwarrior.

The past couple years I have been doing HR stuff, a nice change of pace from programming. That said, when dealing in human matters, one builds a deeper appreciation for computers. I never wrote shell scripts before, and this seemed like a good time to learn bash.

I digress, here’s fin:

  • It’s 38 lines of bash, no dependencies
  • Tasks are all represented by their own text files, with filenames being task names and file contents being any metadata or content you want to associate with the task.
  • Tasks are created in a folder called outstanding_tasks. When you complete a task, its file is moved to another folder called completed_tasks.
  • Cloud syncing is trivial via dropbox or google drive.
  • Shell tab completion enables quick referencing of existing tasks.
dope~: todo write medium post
— — — — — — — — — — — TODO — — — — — — — — — — — — 
[] write medium post
— — — — — — — — — — — — — — — — — — — — — — — — —
dope~: todo publish medium post
— — — — — — — — — — — TODO — — — — — — — — — — — — 
[] write medium post
[] publish medium post
— — — — — — — — — — — — — — — — — — — — — — — — —
dope~: fin write\ medium\ post
— — — — — — — — — — — TODO — — — — — — — — — — — — 
[] publish medium post
— — — — — — — — — — — — — — — — — — — — — — — — —
DONE with write medium post
dope~: cd /any/directory/
dope~: todo
— — — — — — — — — — — TODO — — — — — — — — — — — — 
[] publish medium post
— — — — — — — — — — — — — — — — — — — — — — — — —

To get started with fin, follow these simple steps:

  1. Create folders ~/TODO/outstanding_tasks and ~/TODO/completed_tasks
  2. For Google Drive syncing:
ln -s ~/Google\ Drive/TODO ~/TODO

3. For Dropbox syncing:

ln -s ~/TODO ~/Dropbox/TODO

4. Paste this shell script into your ~/.profile :

BOLD_AND_UNDERLINED=”\e[1;4m”
GREEN=”\e[32m”
STANDARD=”\e[0m”
TODO_LIST_LABEL=”\n — — — — — — — — — — — -TODO — — — — — — — — — — — — -\n”
TODO_LIST_END=” — — — — — — — — — — — — — — — — — — — — — — — — — — \n\n”
TASKS_DIR=~/TODO/outstanding_tasks/
COMPLETED_DIR=~/TODO/completed_tasks/
function todo {
if [ -z “$1” ]
then
printf “${TODO_LIST_LABEL}”
find ${TASKS_DIR} -not -path ‘*/\.*’ -type f -execdir echo ‘{}’ ‘;’ | nl -s ‘[] ‘ -b n
printf “${TODO_LIST_END}”
else
touch ${TASKS_DIR}”${*}”
todo
fi
}
_fin () {
IFS=$’\n’ tmp=( $(compgen -W “$(ls “${TASKS_DIR}”)” — “${COMP_WORDS[$COMP_CWORD]}” ))
COMPREPLY=( “${tmp[@]// /\ }” )
IFS=$’ ‘
}
function fin {
if ! [ -z “$1” ] && [ -a ${TASKS_DIR}”${*}” ]
then
mv ${TASKS_DIR}”$1" ${COMPLETED_DIR}
todo
printf “ ${GREEN}DONE ${STANDARD}with ${BOLD_AND_UNDERLINED}$1${STANDARD}\n\n”
else
echo -e “\nusage: fin [existing task to complete]\n”
fi
}
complete -o default -F _fin fin