4 program=$(basename "$0")
5 fail() { echo "$1"; exit 1; }
8 expr "$f" : [Tt][Oo][Dd][Oo] > /dev/null && todo_file="$f" && break
11 [ -n $todo_file ] || todo_file="${TODO_FILE:-${PWD}/TODO}"
13 todo_alt_file="${TODO_ALT_FILE:-${PWD}/REMEMBER}"
14 done_file="${DONE_FILE:-${PWD}/DONE}"
17 echo "usage: $program TASK"
18 echo " $program [-d LINENUM] [-e] [-Ss QUERY]"
25 sed -n "${int}!p" "$todo_file" > "$tmpfile"
26 mv "$todo_file" "${todo_file}~"
27 mv "$tmpfile" "$todo_file"
31 lines=$(wc -l < "$todo_file")
32 width=$(echo $lines | wc -c)
33 nl -s' ' -w"$width" "$todo_file"
37 if getopts hed:S:s: opt; then
39 (e) $EDITOR "$todo_file"
43 (S) t_print | grep -iw "$OPTARG"
45 (s) t_print | grep -i "$OPTARG"
52 elif test -n "$1"; then
53 echo "$@" >> "$todo_file"