scripts/dav-bash-completion.bash

Sat, 15 Sep 2018 11:56:36 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 15 Sep 2018 11:56:36 +0200
changeset 470
6bf798ad3aec
parent 457
0eabb741d5d3
child 673
8e7e56cfc103
permissions
-rw-r--r--

adds encrypted password store

new repo config element: <stored-user>
new dav command: add-user

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