1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
# (C) 2016-2025 magicant
# Completion script for the "git-reflog" command.
# Supports Git 2.48.1.
function completion/git-reflog {
WORDS=(git reflog "${WORDS[2,-1]}")
command -f completion//reexecute
}
function completion/git::reflog:arg
if [ ${WORDS[#]} -le 1 ]; then
complete -P "$PREFIX" delete exists expire list show
else
WORDS=("${WORDS[2,-1]}")
if command -vf "completion/git::reflog:${WORDS[1]}:arg" >/dev/null 2>&1; then
command -f "completion/git::reflog:${WORDS[1]}:arg"
fi
fi
function completion/git::reflog:delete:arg {
# Options are not supported since the delete subcommand is not mainly
# for interactive use.
command -f completion/git::completeref
}
function completion/git::reflog:exists:arg {
command -f completion/git::completeref
}
# Not supported, since the expire subcommand is not mainly for interactive use.
# function completion/git::reflog:expire:arg
# The list subcommand takes no arguments.
# function completion/git::reflog:list:arg
function completion/git::reflog:show:arg {
WORDS=(git log -g --abbrev-commit --pretty=oneline "${WORDS[2,-1]}")
command -f completion//reexecute
}
# vim: set ft=sh ts=8 sts=8 sw=8 et:
|