scripts/dav-bash-completion.bash

Thu, 28 Jun 2018 18:55:14 +0200

author
Mike Becker <universe@uap-core.de>
date
Thu, 28 Jun 2018 18:55:14 +0200
changeset 434
bc173bae3caa
parent 431
1e8592657a01
child 435
def0359fb48f
permissions
-rw-r--r--

improves dav-bash-completion.bash

dav_completion() {
    local davcmd
    local out
    local cmd_res

    davcmd="${COMP_WORDS[0]}"
	out=$( $davcmd complete $COMP_CWORD "${COMP_WORDS[@]}" )
	cmd_res=$?

	if [ $cmd_res == 10 ]; then
		compopt -o nospace
	fi
	if [ $cmd_res == 12 ]; then
		compopt -o default
		COMPREPLY=()
	else
        IFS=$'\n' declare -ga 'COMPREPLY=($out)'
	fi
}

mercurial