bash-completion.sh
branchv_0
changeset 1 27c11cea34de
parent 0 e5d547ab0c51
child 3 3891db9e45b7
equal deleted inserted replaced
0:e5d547ab0c51 1:27c11cea34de
    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=(
       
    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=("''")
    25 	if   [[ "$w1" == "--relation"                      && "x$w0" == "x" ]];    then COMPREPLY=("''")
    37 	elif [[ "$w1" == "--unlink-on-close"                                ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    26 	elif [[ "$w1" == "--endpoint-url"                  && "x$w0" == "x" ]];    then COMPREPLY=("'tcp://*:1234'")
    38 	elif [[ "$w1" == "--queue"                         && "x$w0" == "x" ]];    then COMPREPLY=("''")
       
    39 	elif [[ "$w1" == "--message-count"                 && "x$w0" == "x" ]];    then COMPREPLY=("1")
    27 	elif [[ "$w1" == "--message-count"                 && "x$w0" == "x" ]];    then COMPREPLY=("1")
    40 	else
    28 	else
    41 		OPTIONS=(
    29 		OPTIONS=(
    42 			"--relation"
    30 			"--relation"
    43 			"--unlink-on-close"
    31 			"--endpoint-url"
    44 			"--queue"
       
    45 			"--message-count"
    32 			"--message-count"
    46 		)
    33 		)
    47 		COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0"))
    34 		COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0"))
    48 	fi
    35 	fi
    49 }
    36 }