dotfiles/.config/zsh/zsh_completion/_gitsquash

16 lines
399 B
Plaintext
Raw Normal View History

2020-03-08 19:18:49 +00:00
#compdef gitsquash
local -a h
maxargs=4;
for el in "${words[@]}"; do
[[ $el != -* ]] && break
((++maxargs))
done
echo $maxargs
if [ $CURRENT -lt $maxargs ]; then
commits=$( ([ $PREFIX ] && git log --pretty=%h | grep "^$PREFIX" - | head -10) || git log --pretty=%h -10 )
while read commit; do h+=("$commit:$(git log -1 --pretty=%s $commit)"); done <<< "$commits"
fi
_describe -V "hashes" h