Last Updated: February 25, 2016
·
575
· mfpiccolo

Simple Developer Todo

This is a simple script that I have dropped into my ~/.bash_profile.

# TODO
function t () {
  if [ -z "$1" ]
    then
      for f in ~/Desktop/TODO/*
      do
        basename $f
      done
  elif [ $1 == "-o" ]
    then
      subl -n ~/Desktop/TODO/"$2"
  else
    IFS_OLD="$IFS"
    IFS=$'\n'
    mkdir ~/Desktop/TODO/$@
    touch $(echo ~/Desktop/TODO/$@/notes.txt)
    touch $(echo ~/Desktop/TODO/$@/tasks.txt)
    IFS="$IFS_OLD"
  fi
}

td () {
  if [ $# -eq 0 ]
    then
      for f in ~/Desktop/Done/*
      do
        basename $f
      done
  else
    mv ~/Desktop/TODO/"$@" ~/Desktop/Done/"$@"
  fi
}

_td () {
  local cur opts
  cur="${COMP_WORDS[COMP_CWORD]}"
  opts=$(cd ~/Desktop/TODO ; ls -d * | sed 's|/./||')
  COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
}
complete -F _td td

_t () {
  local cur opts
  cur="${COMP_WORDS[COMP_CWORD]}"
  opts=$(cd ~/Desktop/TODO ; ls -d * | sed 's|/./||')
  COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
}
complete -F _t t

It basically uses a dir structure and text documents as a very simple todo management system.

Just type t <todo-name> in bash and it will add a directory called TODO with the todo-name and inside will be two files: notes.txt and tasks.txt.

When you are done with a task type td <todo-name> and it will move that todo to a done folder on your desktop.

You can open up a specific todo directory by using -o i.e. t -o random-todo and sublime will open up with the directory. If you just type t -o it will open sublime with all your todos.

This script includes auto completion to navigate the todo directory. Play around with tab and it will list out your todos and try to complete based on the todos in your TODO directory.

This was inspired by other todo lists from coderwall, stackoverflow and some other places. I don't have links or remember where they came from but thank you if you were one of those posters.