scripts/dav-bash-completion.bash

Wed, 11 Jul 2018 17:07:01 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Wed, 11 Jul 2018 17:07:01 +0200
changeset 445
c525f049c8b7
parent 435
def0359fb48f
child 457
0eabb741d5d3
permissions
-rw-r--r--

renames dav-sync -D option to -R

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
}

complete -F dav_completion dav

mercurial