bash-completion.sh
branchv_0
changeset 3 610783d70ae9
parent 2 0799eaf338b9
--- a/bash-completion.sh	Sun May 08 21:42:14 2022 +0200
+++ b/bash-completion.sh	Sun Jun 05 22:51:45 2022 +0200
@@ -22,23 +22,23 @@
 	w2=${COMP_WORDS[COMP_CWORD-2]}
 	w3=${COMP_WORDS[COMP_CWORD-3]}
 
-	DATA_TYPE=(
-		"string"
-		"integer"
-		"boolean"
-	)
-
-	BOOLEAN_VALUES=(
-		"true"
-		"false"
+	CONNECTION_OPTIONS=(
+		"username"
+		"password"
 	)
 
 	if   [[ "$w1" == "--relation"                      && "x$w0" == "x" ]];    then COMPREPLY=("''")
+	elif [[ "$w1" == "--connection-string"             && "x$w0" == "x" ]];    then COMPREPLY=("'mqtt://localhost:1883'")
+	elif [[ "$w1" == "--connection-option"                              ]];    then COMPREPLY=($(compgen -W "${CONNECTION_OPTIONS[*]}" -- "$w0"))
+	elif [[ "$w2" == "--connection-option"             && "x$w0" == "x" ]];    then COMPREPLY=("''")
 	elif [[ "$w1" == "--stream"                        && "x$w0" == "x" ]];    then COMPREPLY=("''")
 	elif [[ "$w1" == "--message-count"                 && "x$w0" == "x" ]];    then COMPREPLY=("1")
 	else
 		OPTIONS=(
 			"--relation"
+			#"--connection-name"
+			"--connection-string"
+			"--connection-option"
 			"--stream"
 			"--message-count"
 		)