Skip to content

Instantly share code, notes, and snippets.

@stormouse
Created September 28, 2022 13:20
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 stormouse/1c3eaa0286f9e3834d66871e42b7de6b to your computer and use it in GitHub Desktop.
Save stormouse/1c3eaa0286f9e3834d66871e42b7de6b to your computer and use it in GitHub Desktop.
note taking script
function tn {
local EDITOR=${TAKE_NOTE_EDITOR:-"vim"}
local DIRECTORY=${TAKE_NOTE_DIRECTORY:-"${HOME}/.notes"}
local ACTIVE_NOTE=${TAKE_NOTE_ACTIVE_NOTE:-"note-$(date +%Y-%m-%d)"}
if [ "${#}" == "0" ]; then
${EDITOR} ${DIRECTORY}/${ACTIVE_NOTE}
else
printf "[%s] %s\n" "$(date +%H:%M:%S)" "${*}" | tee -a ${DIRECTORY}/${ACTIVE_NOTE}
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment