Last active
September 13, 2025 16:56
-
-
Save raylee/12a94099c9d94bc38de790c19882d2cf to your computer and use it in GitHub Desktop.
The world's dumbest todo list manager. Uses fzf to select tasks as started or done, via `td s` or `td d`. `td a` to archive done tasks. `td l` to list tasks. `td <anything else here>` adds a task to the inbox. I have `td l` at the bottom of my shell .rc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function td() { # ☐◑✔ | |
| local todo_folder=~/.todo | |
| local taskfile=${todo_folder}/tasks.md | |
| local open="☐" started="◑" done="✔" | |
| local date_started="🌱" date_finished="⚡" | |
| local timestamp="$(date +'%Y·%m·%d')" | |
| local tmpfile | |
| tmpfile=$(mktemp -p ${todo_folder}) || { echo mktemp failed; return; } | |
| if [ ! -f "$taskfile" ]; then | |
| printf "inbox:\n\nArchive:\n" >> "$taskfile" | |
| fi | |
| case "$*" in | |
| e|-e|edit) | |
| cp "${taskfile}" "${tmpfile}" | |
| $EDITOR $taskfile | |
| return | |
| ;; | |
| d|-d|done) | |
| done_line=$(fzf < "${taskfile}" --accept-nth '{n}' --layout=reverse) | |
| [ "$done_line" == "" ] && return | |
| (( done_line++ )) | |
| sed < "${taskfile}" -E "${done_line}s:^\t($open|$started)(.*)$:\t$done\2 ${date_finished}${timestamp}:" > $tmpfile | |
| cp $tmpfile "${taskfile}" | |
| return | |
| ;; | |
| s|-s|start) | |
| started_line=$(fzf < "${taskfile}" --accept-nth '{n}' --layout=reverse) | |
| [ "$started_line" == "" ] && return | |
| (( started_line++ )) | |
| sed < "${taskfile}" -E "${started_line}s:^\t($open|$done):\t$started:" > $tmpfile | |
| cp $tmpfile "${taskfile}" | |
| return | |
| ;; | |
| ""|l|-l|ls|l\ [0-9]|l\ [0-9][0-9]|ls\ [0-9]|ls\ [0-9][0-9]) | |
| rm "${tmpfile}" | |
| shift | |
| local dim=$'\e[2m' reset=$'\e[0m' partial=$'\e[38;5;96m' | |
| tabs 5 | |
| grep -E "$started " "${taskfile}" \ | |
| | sed -E "s:(• [0-9·]+)$:${dim}\1${reset}:" \ | |
| | sed -E "s:($started.*)$:${partial}\1${reset}:" | |
| grep -E "$open " "${taskfile}" \ | |
| | head -n ${1:-10} \ | |
| | sed -E "s:(• [0-9·]+)$:${dim}\1${reset}:" \ | |
| | sed -E "s:($started.*)$:${partial}\1${reset}:" | |
| tabs | |
| return | |
| ;; | |
| a|-a|archive) | |
| { | |
| grep -vE "^[[:space:]]*$done " $taskfile | |
| grep -E "^[[:space:]]*$done " $taskfile | |
| } > $tmpfile | |
| cp $tmpfile ${taskfile} | |
| return | |
| ;; | |
| esac | |
| printf -v item "\t$open %s • %s\n" "$*" "$(date +'%Y·%m·%d')" | |
| sed "/inbox:/a \\ | |
| $item" < "${taskfile}" > "$tmpfile" | |
| cp "$tmpfile" "${taskfile}" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment