bash-completion.sh
branchv_0
changeset 1 ccaed729f8d3
parent 0 452d06d24ac2
child 2 e6294ba5017f
equal deleted inserted replaced
0:452d06d24ac2 1:ccaed729f8d3
    20 	w0=${COMP_WORDS[COMP_CWORD]}
    20 	w0=${COMP_WORDS[COMP_CWORD]}
    21 	w1=${COMP_WORDS[COMP_CWORD-1]}
    21 	w1=${COMP_WORDS[COMP_CWORD-1]}
    22 	w2=${COMP_WORDS[COMP_CWORD-2]}
    22 	w2=${COMP_WORDS[COMP_CWORD-2]}
    23 	w3=${COMP_WORDS[COMP_CWORD-3]}
    23 	w3=${COMP_WORDS[COMP_CWORD-3]}
    24 
    24 
    25 	DATA_TYPE=(
    25 	if   [[ "$w1" == "--endpoint-url"                  && "x$w0" == "x" ]];    then COMPREPLY=("'tcp://localhost:1234'")
    26 		"string"
       
    27 		"integer"
       
    28 		"boolean"
       
    29 	)
       
    30 
       
    31 	BOOLEAN_VALUES=(
       
    32 		"true"
       
    33 		"false"
       
    34 	)
       
    35 
       
    36 	if   [[ "$w1" == "--relation"                      && "x$w0" == "x" ]];    then COMPREPLY=("''")
       
    37 	elif [[ "$w1" == "--unlink-on-close"                                ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
       
    38 	elif [[ "$w1" == "--queue"                         && "x$w0" == "x" ]];    then COMPREPLY=("''")
       
    39 	else
    26 	else
    40 		OPTIONS=(
    27 		OPTIONS=(
    41 			"--relation"
    28 			"--endpoint-url"
    42 			"--unlink-on-close"
       
    43 			"--queue"
       
    44 		)
    29 		)
    45 		COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0"))
    30 		COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0"))
    46 	fi
    31 	fi
    47 }
    32 }
    48 
    33