Todo.txt Manager ================ A small shell function I use to manage my todo.txt file. It supports priorities like (A), (B), (C), and integrates with Git for simple versioning and sync. Just plain text, no dependencies. Save it in your shell rc file and run `t help` for usage. # ====================== # Task Management # ====================== # Todo.txt Manager with Git Integration # ----------------------------------- # Unified command for todo.txt operations: # t edit - Edit tasks (alias: t) # t list - Show sorted tasks (alias: tl) # t add - Add a new task quickly # t done - Mark a task as done # t push - Commit & push changes # # Default location: ~/projects/sourcehut/todo/todo.txt # Customize with: export TODOTXT_DIR=/your/path # Add to shell: source ~/path/to/this/script t() { local todo_dir="${TODOTXT_DIR:-$HOME/projects/sourcehut/todo}" local todo_file="$todo_dir/todo.txt" # ensure directory and file exist mkdir -p "$todo_dir" || return 1 touch "$todo_file" || return 1 case "$1" in # Edit todo.txt edit|e|"") "${VISUAL:-${EDITOR:-nvi}}" "$todo_file" || { echo "Error: failed to open editor." >&2 return 1 } ;; # List sorted tasks (ignore empty lines) list|l) grep -v '^[[:space:]]*$' "$todo_file" | sort -k1 ;; # Add a new task inline add|a) shift if [ -z "$*" ]; then echo "Usage: t add " >&2 return 1 fi printf '%s\n' "$*" >>"$todo_file" echo "[+] Added: $*" ;; # Mark a line as done done|d) shift if [ -z "$1" ]; then echo "Usage: t done " >&2 return 1 fi if [[ "$1" =~ ^[0-9]+$ ]]; then sed -i "${1}s/^/x /" "$todo_file" else local safe safe=$(printf '%s' "$1" | sed 's/[.[\*^$/]/\\&/g') sed -i "s/^.*${safe}.*/x &/" "$todo_file" fi echo "[✓] Marked done: $1" ;; # Git push changes push|p) ( cd "$todo_dir" || exit 1 if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then git add todo.txt git commit -m "Update todo.txt on $(date +%Y-%m-%d)" >/dev/null 2>&1 || \ echo "No changes to commit." git push else echo "Not a Git repository: skipping push." fi ) ;; # Show help help|-h|--help) cat <&2 return 1 ;; esac } ---------------------------------------- Example usage: t add "(A) Write article about aerc + postfix + mbsync" t add "(C) Study Slackware installer GRUB support" t list t done 2 t push ---------------------------------------- Simple, local, and versioned — just how I like my tools.