/usr/share/yash/completion/git-stash is in yash 2.43-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | # (C) 2011 magicant
# Completion script for the "git-stash" command.
# Supports Git 1.7.7.
function completion/git-stash {
WORDS=(git stash "${WORDS[2,-1]}")
command -f completion//reexecute
}
function completion/git::stash:arg
if [ ${WORDS[#]} -le 1 ]; then #>>#
complete -P "$PREFIX" -D "restore stash contents" apply
complete -P "$PREFIX" -D "restore stash contents in a new branch" branch
complete -P "$PREFIX" -D "remove all stashes" clear
complete -P "$PREFIX" -D "create a stash commit without adding it to the stash list" create
complete -P "$PREFIX" -D "remove stash contents without restoring it" drop
complete -P "$PREFIX" -D "list existing stashes" list
complete -P "$PREFIX" -D "restore stash contents and remove it from the stash list" pop
complete -P "$PREFIX" -D "save local changes in a new stash and reset to HEAD" save
complete -P "$PREFIX" -D "show stash contents" show
else #<<#
WORDS=("${WORDS[2,-1]}")
if command -vf "completion/git::stash:${WORDS[1]}:arg" >/dev/null 2>&1; then
command -f "completion/git::stash:${WORDS[1]}:arg"
fi
fi
function completion/git::stash:apply:arg {
command -f completion/git::stash:pop:arg
}
function completion/git::stash:branch:arg {
if [ ${WORDS[#]} -le 1 ]; then
command -f completion/git::completeref --branches
else
command -f completion/git::stash:completestash
fi
}
#function completion/git::stash:clear:arg {
#}
#function completion/git::stash:create:arg {
#}
function completion/git::stash:drop:arg {
command -f completion/git::stash:pop:arg
}
function completion/git::stash:list:arg {
OPTIONS=()
if command -vf completion/git::log:getopt >/dev/null 2>&1 ||
. -AL completion/git-log; then
command -f completion/git::log:getopt
fi
command -f completion//parseoptions -n
case $ARGOPT in
(-)
command -f completion//completeoptions
;;
('')
;;
(*)
command -f completion/git::log:compopt
;;
esac
}
function completion/git::stash:pop:arg {
OPTIONS=( #>#
"q --quiet; print error messages only"
) #<#
case ${WORDS[1]} in (apply|pop)
OPTIONS=("$OPTIONS" #>#
"--index; restore the index as well as the working copy"
) #<#
esac
command -f completion//parseoptions
case $ARGOPT in
(-)
command -f completion//completeoptions
;;
('')
command -f completion/git::stash:completestash
;;
esac
}
function completion/git::stash:save:arg {
OPTIONS=( #>#
"a --all; stash all files including ignored/untracked files"
"--keep-index; keep the index intact"
"p --patch; interactively choose patch hunks to stash"
"q --quiet; print error messages only"
"--no-keep-index; stash and reset the index"
"u --include-untracked; stash untracked files as well as tracked files"
) #<#
command -f completion//parseoptions
case $ARGOPT in
(-)
command -f completion//completeoptions
;;
# ('')
# ;;
esac
}
function completion/git::stash:show:arg {
OPTIONS=()
if command -vf completion/git::diff:getopt >/dev/null 2>&1 ||
. -AL completion/git-diff; then
command -f completion/git::diff:getopt
fi
command -f completion//parseoptions -n
case $ARGOPT in
(-)
command -f completion//completeoptions
;;
('')
command -f completion/git::stash:completestash
;;
(*)
command -f completion/git::diff:compopt
;;
esac
}
function completion/git::stash:completestash {
typeset name message
while read -r name message; do
name=${name%:}
complete -P "$PREFIX" -D "$message" -- "$name"
done 2>/dev/null <(git stash list)
}
# vim: set ft=sh ts=8 sts=8 sw=8 noet:
|