You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
564 B
Bash

#!/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