Created
January 30, 2023 04:24
-
-
Save gwpantazes/0e0fea749f12b23a073ac7e7b73023f2 to your computer and use it in GitHub Desktop.
todoproject - A very simple project idea logger
This file contains 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
#!/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