scripts/dav-bash-completion.bash

Wed, 10 Apr 2019 12:54:24 +0200

author
Mike Becker <universe@uap-core.de>
date
Wed, 10 Apr 2019 12:54:24 +0200
changeset 561
5e6df4f502d3
parent 457
0eabb741d5d3
child 673
8e7e56cfc103
permissions
-rw-r--r--

harmonizes output of push and pull
pull gets conflict counter, push uses the term conflict instead of skipped (the output also says conflict: ...)

dav_completion() {
    local davcmd
    local out
    local cmd_res

    davcmd="${COMP_WORDS[0]} complete $COMP_CWORD ${COMP_WORDS[@]}"
    out=$(eval $davcmd)
    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