4 program=$(basename "$0")
5 fail() { echo "$1"; exit 1; }
7 todo_file="${TODO_FILE:-${PWD}/TODO}"
9 test -f "$todo_file" || fail "TODO_FILE not found"
12 echo "usage: $program TASK"
13 echo " $program [-d LINENUM] [-e] [-Ss QUERY]"
20 sed -n "${int}!p" "$todo_file" > "$tmpfile"
21 mv "$todo_file" "${todo_file}~"
22 mv "$tmpfile" "$todo_file"
26 lines=$(wc -l < "$todo_file")
27 width=$(echo $lines | wc -c)
28 nl -s' ' -w"$width" "$todo_file"
32 if getopts hed:S:s: opt; then
34 (e) $EDITOR "$todo_file"
38 (S) t_print | grep -iw "$OPTARG"
40 (s) t_print | grep -i "$OPTARG"
47 elif test -n "$1"; then
48 echo "$@" >> "$todo_file"