scripts/dav-bash-completion.bash

changeset 673
8e7e56cfc103
parent 457
0eabb741d5d3
child 676
fb466ba2edc5
equal deleted inserted replaced
672:4bfe452a2665 673:8e7e56cfc103
1 dav_completion() { 1 dav_completion() {
2 local davcmd
3 local out 2 local out
4 local cmd_res 3 local cmd_res
5 4
6 davcmd="${COMP_WORDS[0]} complete $COMP_CWORD ${COMP_WORDS[@]}" 5 out="$(${COMP_WORDS[0]} complete $COMP_CWORD ${COMP_WORDS[@]})"
7 out=$(eval $davcmd)
8 cmd_res=$? 6 cmd_res=$?
9 7
10 if [ $cmd_res == 10 ]; then 8 if [[ $cmd_res -eq 10 ]]; then
11 compopt -o nospace 9 compopt -o nospace
12 fi 10 fi
13 if [ $cmd_res == 12 ]; then 11 if [[ $cmd_res -eq 12 ]]; then
14 compopt -o default 12 compopt -o default
15 COMPREPLY=() 13 COMPREPLY=()
16 else 14 else
17 IFS=$'\n' declare -ga 'COMPREPLY=($out)' 15 IFS=$'\n' declare -ga 'COMPREPLY=($out)'
18 fi 16 fi

mercurial