#!/bin/bash # Opens the default log file with vim. Accepts the # standard `date` offset. Prompts to commit. relpath=$(datepath "$*") dir="${KN}/log/$relpath" file="$dir/README.md" mkdir -p "${dir}" # prepend a timestamped heading tmpfile=$(mktemp) hnow "$*" >"${tmpfile}" echo -e "\n\n" >>"${tmpfile}" if [ -e "${file}" ]; then cat "${file}" >>"${tmpfile}" fi mv "${tmpfile}" "${file}" echo "${file}" vim +3 "${file}" read -p 'Do you want to commit? ' commit if [[ ! $commit =~ ^[Yy] ]]; then exit fi cd "${dir}" git add "${file}" git commit #git push