bash-completion.sh
branchv_0
changeset 7 ff69af3c67a3
parent 5 accf73de6778
child 8 8730e2d0db0e
equal deleted inserted replaced
6:d777064beb32 7:ff69af3c67a3
    26 		"string"
    26 		"string"
    27 		"integer"
    27 		"integer"
    28 		"boolean"
    28 		"boolean"
    29 	)
    29 	)
    30 
    30 
       
    31 	XINCLUDE=(
       
    32 		"true"
       
    33 		"false"
       
    34 	)
       
    35 
    31 	# FIXME: user must type " and then press TAB otherwise the completion is broken due to the : colon
    36 	# FIXME: user must type " and then press TAB otherwise the completion is broken due to the : colon
    32 	#
    37 	#
    33 	# can be fixed by global modification of environment variable:
    38 	# can be fixed by global modification of environment variable:
    34 	#	COMP_WORDBREAKS=${COMP_WORDBREAKS//:}
    39 	#	COMP_WORDBREAKS=${COMP_WORDBREAKS//:}
    35 	# but it will affect other completions (where : is a separator)
    40 	# but it will affect other completions (where : is a separator)
    52 	elif [[ "$w1" == "--attribute"     && "x$w0" == "x" ]];    then COMPREPLY=("''")
    57 	elif [[ "$w1" == "--attribute"     && "x$w0" == "x" ]];    then COMPREPLY=("''")
    53 	elif [[ "$w2" == "--attribute"                      ]];    then COMPREPLY=($(compgen -W "${DATA_TYPE[*]}" -- "$w0"))
    58 	elif [[ "$w2" == "--attribute"                      ]];    then COMPREPLY=($(compgen -W "${DATA_TYPE[*]}" -- "$w0"))
    54 	elif [[ "$w3" == "--attribute"     && "x$w0" == "x" ]];    then COMPREPLY=("''")
    59 	elif [[ "$w3" == "--attribute"     && "x$w0" == "x" ]];    then COMPREPLY=("''")
    55 	elif [[ "$w1" == "--namespace"     && "x$w0" == "x" ]];    then COMPREPLY=("''")
    60 	elif [[ "$w1" == "--namespace"     && "x$w0" == "x" ]];    then COMPREPLY=("''")
    56 	elif [[ "$w2" == "--namespace"                      ]];    then COMPREPLY=($(compgen -W "${XMLNS[*]}" -- "$w0"))
    61 	elif [[ "$w2" == "--namespace"                      ]];    then COMPREPLY=($(compgen -W "${XMLNS[*]}" -- "$w0"))
       
    62 	elif [[ "$w1" == "--xinclude"                       ]];    then COMPREPLY=($(compgen -W "${XINCLUDE[*]}" -- "$w0"))
    57 	else
    63 	else
    58 		OPTIONS=(
    64 		OPTIONS=(
    59 			"--namespace"
    65 			"--namespace"
    60 			"--relation"
    66 			"--relation"
    61 			"--records"
    67 			"--records"
    62 			"--name-is-xpath"
    68 			"--name-is-xpath"
    63 			"--attribute"
    69 			"--attribute"
       
    70 			"--xinclude"
    64 		)
    71 		)
    65 		COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0"))
    72 		COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0"))
    66 	fi
    73 	fi
    67 }
    74 }
    68 
    75