mirror of
https://github.com/rwxrob/dot
synced 2024-11-16 21:25:29 +00:00
34 lines
564 B
Plaintext
34 lines
564 B
Plaintext
|
#!/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
|