Skip to content

Instantly share code, notes, and snippets.

@gwpantazes
Created January 30, 2023 04:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gwpantazes/0e0fea749f12b23a073ac7e7b73023f2 to your computer and use it in GitHub Desktop.
Save gwpantazes/0e0fea749f12b23a073ac7e7b73023f2 to your computer and use it in GitHub Desktop.
todoproject - A very simple project idea logger
#!/usr/bin/env bash
# Configure by exporting TODOPROJECT_FILE, the file path to write to.
# Recommended: alias tp="path/to/todoproject.sh"
todoproject_file="${TODOPROJECT_FILE:-$HOME/todoproject.tsv}"
function initFile {
if [[ -f "${todoproject_file}" ]]; then return 0; fi
mkdir -p "$(dirname "${todoproject_file}")"
printf "Timestamp of Thought\tProject\n" > "${todoproject_file}"
}
function todoProject {
local project
if [[ $# -gt 0 ]]; then
project="$*"
else
echo "What project are you thinking of? Don't worry about duplicates!"
read -r project
fi
printf "%s\t%s\n" "$(date)" "${project}" >> "${todoproject_file}"
}
function showTodoProjectRecent {
cat <(head -n 1 "${todoproject_file}") <(tail -n 3 "${todoproject_file}") | column -t -s $'\t'
}
initFile
todoProject "$@"
showTodoProjectRecent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment