-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathddclassify.sh
More file actions
55 lines (49 loc) · 1.42 KB
/
Copy pathddclassify.sh
File metadata and controls
55 lines (49 loc) · 1.42 KB
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
# . ./ddclassify.sh
_comp_ddclassify()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="-h --help -t -a -i -d -p -r -e -c -m -misfile -x -depth -g -v"
sopt="-x -depth -g -v"
case "${prev}" in
-d|-c|-e)
COMPREPLY=( $(compgen -d ${cur} ))
return
;;
-m)
COMPREPLY=( $(compgen -W "{1,2,4,8,17,18,20,24}" -- ${cur}) )
return
;;
-x)
_filedir 'xml'
return
;;
-depth)
COMPREPLY=( $(compgen -W "{1..3}" -- ${cur}) )
return
;;
*)
;;
esac
# for (( j=${#COMP_WORDS[@]}-1 ; j>=0 ; j-- )); do
# i="${COMP_WORDS[j]}"
for i in "${COMP_WORDS[@]}"; do
if [[ "$i" == "-t" ]]; then
COMPREPLY=( $(compgen -W "-a ${sopt}" -- ${cur}) )
return
elif [[ "$i" == "-a" ]]; then
COMPREPLY=( $(compgen -W "-t ${sopt}" -- ${cur}) )
return
elif [[ "$i" == "-i" ]]; then
COMPREPLY=( $(compgen -W "${sopt}" -- ${cur}) )
return
elif [[ "$i" == "-d" ]]; then
COMPREPLY=( $(compgen -W "-p -r -e -c -m -misfile ${sopt}" -- ${cur}) )
return
fi
done
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
}
complete -F _comp_ddclassify ddclassify