├── README.md ├── internals ├── echo_in_red ├── show_todo └── to_todo_history_file ├── todo ├── todone └── todos_completed /README.md: -------------------------------------------------------------------------------- 1 | Two tiny programs, `todo` and `todone`. I like to alias them to `t` and `d`. 2 | 3 | One bonus program, `todos_completed`, to see how much you've accomplished! 4 | 5 | # Usage # 6 | 7 | Here's an example usage with the aliases: 8 | 9 | ```bash 10 | $ t feed the plants 11 | 1. feed the plants 12 | $ t water the cat 13 | 1. feed the plants 14 | 2. water the cat 15 | $ t 16 | 1. feed the plants 17 | 2. water the cat 18 | $ t brush the cat 19 | 1. feed the plants 20 | 2. water the cat 21 | 3. brush the cat 22 | $ d cat 23 | !! multiple matches !! 24 | 2. water the cat 25 | 3. brush the cat 26 | $ d brush 27 | 1. feed the plants 28 | 2. water the cat 29 | $ d 1 30 | 1. water the cat 31 | $ tail -5 $TODOHISTORY 32 | + feed the plants; Wed Mar 20 23:49:37 EDT 2013 33 | + water the cat; Wed Mar 20 23:49:39 EDT 2013 34 | + brush the cat; Wed Mar 20 23:49:54 EDT 2013 35 | - brush the cat; Wed Mar 20 23:50:37 EDT 2013 36 | - feed the plants; Wed Mar 20 23:50:39 EDT 2013 37 | $ todos_completed -1hour 38 | √ brush the cat 39 | √ feed the plants 40 | ``` 41 | 42 | The lists are just plain text files, so it's easy to open them up and edit them 43 | by hand whenever that's necessary. 44 | 45 | # Installation # 46 | 47 | Clone the repo somewhere on your `$PATH`, like maybe `~/bin` if you use that: 48 | 49 | ```bash 50 | git clone git@github.com:mattjj/todo-bash.git ~/bin/todo 51 | ``` 52 | 53 | These programs require an environment variable `TODOFILE` be set to a path at 54 | which the todo list will be stored as a plain text file. There are also a 55 | couple optional variables. You might add something like this to your `.bashrc` 56 | or `.zshrc`: 57 | 58 | ```bash 59 | export TODOFILE=~/Dropbox/todo/todo 60 | export TODOHISTORY=~/Dropbox/todo/todo-history 61 | alias t=todo 62 | alias d=todone 63 | ``` 64 | 65 | or this to your `config.fish`: 66 | 67 | ```csh 68 | set -x TODOFILE ~/Dropbox/todo/todo 69 | set -x TODOHISTORY ~/Dropbox/todo/todo-history 70 | alias t=todo 71 | alias d=todone 72 | ``` 73 | -------------------------------------------------------------------------------- /internals/echo_in_red: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo -en "\033[1;31m" 4 | echo "$@" 5 | echo -en "\033[m" 6 | -------------------------------------------------------------------------------- /internals/show_todo: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -z "$TODOFILE" ] 4 | then 5 | echo_in_red "environment variable TODOFILE not set" 6 | exit 1 7 | else 8 | awk '{print NR". " $0}' <$TODOFILE 9 | fi 10 | -------------------------------------------------------------------------------- /internals/to_todo_history_file: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -n "$TODOHISTORY" ] 4 | then 5 | cat >> $TODOHISTORY # is this 'cat' avoidable? exec doesn't work... 6 | fi 7 | -------------------------------------------------------------------------------- /todo: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | codedir="$( cd "$( dirname $( readlink "${BASH_SOURCE[0]}" ) )" && pwd )" 4 | PATH="$codedir/internals/:$PATH" 5 | 6 | usage() 7 | { 8 | command=${0##*/} 9 | cat <> "$TODOFILE" 37 | echo "+ $*; $(date)" | to_todo_history_file 38 | show_todo 39 | fi 40 | fi 41 | fi 42 | -------------------------------------------------------------------------------- /todone: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | codedir="$(cd "$(dirname $(readlink "${BASH_SOURCE[0]}"))" && pwd)" 4 | PATH="$codedir/internals/:$PATH" 5 | 6 | usage() 7 | { 8 | command=${0##*/} 9 | cat <