improves 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 433
7096666628ca
child 435
def0359fb48f

improves dav-bash-completion.bash

scripts/dav-bash-completion.bash file | annotate | diff | comparison | revisions
--- a/scripts/dav-bash-completion.bash	Thu Jun 28 17:58:37 2018 +0200
+++ b/scripts/dav-bash-completion.bash	Thu Jun 28 18:55:14 2018 +0200
@@ -1,18 +1,20 @@
 dav_completion() {
-	OUT=$( /export/home/olaf/Projekte/dav/build/dav complete $COMP_CWORD "${COMP_WORDS[@]}" )
-	CMD_RES=$?
-	if [ $CMD_RES == 10 ]; then
+    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
+	if [ $cmd_res == 12 ]; then
 		compopt -o default
 		COMPREPLY=()
 	else
-		TMP_IFS=$IFS
-		IFS='
-		'
-		COMPREPLY=( $OUT )
-		IFS=$TMP_IFS
+        IFS=$'\n' declare -ga 'COMPREPLY=($out)'
 	fi
 }
 

mercurial