Commit bf3421e5 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

added automatic committing to .vim/spell/update.sh

parent 81b26080
Loading
Loading
Loading
Loading
+26 −2
Original line number Diff line number Diff line
#!/bin/sh
#!/bin/bash
SPELL_DIR=`dirname $0`
GIT_DIR=`git rev-parse --git-dir`
declare -a FILES

if [ -z "${DEBUG}" ]; then
	silent_flag=-s
	quit_flag="-c :q"
fi
for file in `dirname $0`/*.add; do

for file in "$SPELL_DIR"/*.add; do
	mv "${file}" "${file}.tmp"
	sort -f -u "${file}.tmp" > "${file}"
	rm "${file}.tmp"
@@ -11,4 +16,23 @@ for file in `dirname $0`/*.add; do
		-c ':mkspell! %' \
		-c ':runtime spell/cleanadd.vim' \
		${quit_flag} "${file}"
	[[ $(basename $file) =~ ^en ]] || FILES+=( "${file}" "${file}.spl" )
done

[ ${#FILES[@]} -gt 0 ] || exit 0

if [ -d "$GIT_DIR"/rebase-merge ]; then
	git add "${FILES[@]}"
	git rebase --continue
elif [ -e "$GIT_DIR"/MERGE_MSG ]; then
	git commit --include "${FILES[@]}"
else
	git commit --only "${FILES[@]}" -F- <<-END_MESSAGE
		vim spell file updates from `hostname` `date +%D`

		Automatically generated:
		  source: .vim/spell/update.sh
		  time: `date`
		  host: `hostname -f`
	END_MESSAGE
fi