Skip to content

Instantly share code, notes, and snippets.

@xicalango
Last active November 1, 2016 15:47
Show Gist options
  • Save xicalango/c68ee6279a97c735bc00609e915509a9 to your computer and use it in GitHub Desktop.
Save xicalango/c68ee6279a97c735bc00609e915509a9 to your computer and use it in GitHub Desktop.
A small script for managing a journal.
#!/usr/bin/env bash
set -e
if [ -z ${XX_NOTES_PATH} ]; then
echo "Please set XX_NOTES_PATH environment variable"
exit 1
fi
FILE_ID=$(date +%F)
FULL_PATH="${XX_NOTES_PATH}/${FILE_ID}-entry.txt"
date +'# %T' >> "${FULL_PATH}"
echo "" >> "${FULL_PATH}"
vim + +start "${FULL_PATH}"
git -C "${XX_NOTES_PATH}" add "${FULL_PATH}"
git -C "${XX_NOTES_PATH}" commit -m "Updated File #${FILE_ID}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment