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

431
1e8592657a01 adds semi-functional bash completion
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 dav_completion() {
434
bc173bae3caa improves dav-bash-completion.bash
Mike Becker <universe@uap-core.de>
parents: 431
diff changeset
2 local davcmd
bc173bae3caa improves dav-bash-completion.bash
Mike Becker <universe@uap-core.de>
parents: 431
diff changeset
3 local out
bc173bae3caa improves dav-bash-completion.bash
Mike Becker <universe@uap-core.de>
parents: 431
diff changeset
4 local cmd_res
bc173bae3caa improves dav-bash-completion.bash
Mike Becker <universe@uap-core.de>
parents: 431
diff changeset
5
bc173bae3caa improves dav-bash-completion.bash
Mike Becker <universe@uap-core.de>
parents: 431
diff changeset
6 davcmd="${COMP_WORDS[0]}"
435
def0359fb48f adds some error detection to completion
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 434
diff changeset
7 out=$( $davcmd complete $COMP_CWORD "${COMP_WORDS[@]}" )
def0359fb48f adds some error detection to completion
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 434
diff changeset
8 cmd_res=$?
434
bc173bae3caa improves dav-bash-completion.bash
Mike Becker <universe@uap-core.de>
parents: 431
diff changeset
9
435
def0359fb48f adds some error detection to completion
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 434
diff changeset
10 if [ $cmd_res == 10 ]; then
def0359fb48f adds some error detection to completion
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 434
diff changeset
11 compopt -o nospace
def0359fb48f adds some error detection to completion
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 434
diff changeset
12 fi
def0359fb48f adds some error detection to completion
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 434
diff changeset
13 if [ $cmd_res == 12 ]; then
def0359fb48f adds some error detection to completion
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 434
diff changeset
14 compopt -o default
def0359fb48f adds some error detection to completion
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 434
diff changeset
15 COMPREPLY=()
def0359fb48f adds some error detection to completion
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 434
diff changeset
16 else
434
bc173bae3caa improves dav-bash-completion.bash
Mike Becker <universe@uap-core.de>
parents: 431
diff changeset
17 IFS=$'\n' declare -ga 'COMPREPLY=($out)'
435
def0359fb48f adds some error detection to completion
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 434
diff changeset
18 fi
431
1e8592657a01 adds semi-functional bash completion
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 }
1e8592657a01 adds semi-functional bash completion
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20
435
def0359fb48f adds some error detection to completion
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 434
diff changeset
21 complete -F dav_completion dav
def0359fb48f adds some error detection to completion
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 434
diff changeset
22

mercurial