rwxrob-dot/scripts/_old/log

34 lines
564 B
Plaintext
Raw Normal View History

2022-02-09 07:29:05 +00:00
#!/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