bash-completion.sh
branchv_0
changeset 8 9f89ecc071bf
parent 3 be6f2e307a65
equal deleted inserted replaced
7:68b93b82f1cc 8:9f89ecc071bf
    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 	local DATA_TYPE=(
    26 		"string"
    26 		"string"
    27 		"integer"
    27 		"integer"
    28 		"boolean"
    28 		"boolean"
    29 	)
    29 	)
    30 
    30 
    31 	BOOLEAN_VALUES=(
    31 	local BOOLEAN_VALUES=(
    32 		"true"
    32 		"true"
    33 		"false"
    33 		"false"
    34 	)
    34 	)
    35 
    35 
    36 	if   [[ "$w1" == "--relation"                      && "x$w0" == "x" ]];    then COMPREPLY=("''")
    36 	if   [[ "$w1" == "--relation"                      && "x$w0" == "x" ]];    then COMPREPLY=("''")
    37 	elif [[ "$w1" == "--unlink-on-close"                                ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    37 	elif [[ "$w1" == "--unlink-on-close"                                ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    38 	elif [[ "$w1" == "--queue"                         && "x$w0" == "x" ]];    then COMPREPLY=("''")
    38 	elif [[ "$w1" == "--queue"                         && "x$w0" == "x" ]];    then COMPREPLY=("''")
    39 	else
    39 	else
    40 		OPTIONS=(
    40 		local OPTIONS=(
    41 			"--relation"
    41 			"--relation"
    42 			"--unlink-on-close"
    42 			"--unlink-on-close"
    43 			"--queue"
    43 			"--queue"
    44 		)
    44 		)
    45 		COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0"))
    45 		COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0"))