-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathye-completion.sh
More file actions
35 lines (29 loc) · 835 Bytes
/
ye-completion.sh
File metadata and controls
35 lines (29 loc) · 835 Bytes
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
_ye() {
local cur
compreply() {
COMPREPLY=( $(compgen -W "$(ye plumbing find $cur > /dev/null; cat ~/.ye/plumbing/find | xargs dirname | xargs -n1 basename)" -- "$cur") )
}
local command i
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
if [[ ${COMP_WORDS[i]} == @(cd|x|expand|e|edit|pv|pkg-view|pi|pkg-info) ]]; then
command=${COMP_WORDS[i]}
fi
done
cur=${COMP_WORDS[COMP_CWORD]}
if [[ -n $command ]] && [[ -n $cur ]]; then
if [[ $command = 'cd' ]]; then
case "${COMP_WORDS[2]}" in
wd|src)
compreply
return 0
;;
*)
return 0
esac
else
compreply
fi
fi
return 0
}
complete -F _ye ye