bash-completion.sh
branchv_0
changeset 46 ab27422a34b0
parent 45 5e5815fdcd2d
equal deleted inserted replaced
45:5e5815fdcd2d 46:ab27422a34b0
    26 		"string"
    26 		"string"
    27 		"integer"
    27 		"integer"
    28 		"boolean"
    28 		"boolean"
    29 	)
    29 	)
    30 
    30 
    31 	WRITE_HEADER=(
    31 	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" == "--attribute"                     && "x$w0" == "x" ]];    then COMPREPLY=("''")
    37 	elif [[ "$w1" == "--attribute"                     && "x$w0" == "x" ]];    then COMPREPLY=("''")
    38 	elif [[ "$w2" == "--attribute"                                      ]];    then COMPREPLY=($(compgen -W "${DATA_TYPE[*]}" -- "$w0"))
    38 	elif [[ "$w2" == "--attribute"                                      ]];    then COMPREPLY=($(compgen -W "${DATA_TYPE[*]}" -- "$w0"))
    39 	elif [[ "$w1" == "--write-header"                                   ]];    then COMPREPLY=($(compgen -W "${WRITE_HEADER[*]}" -- "$w0"))
    39 	elif [[ "$w1" == "--write-header"                                   ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
       
    40 	elif [[ "$w1" == "--records-on-stdin"                               ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    40 	else
    41 	else
    41 		OPTIONS=(
    42 		OPTIONS=(
    42 			"--relation"
    43 			"--relation"
    43 			"--write-header"
    44 			"--write-header"
    44 			"--attribute"
    45 			"--attribute"
    45 			"--record"
    46 			"--record"
    46 			"--records"
    47 			"--records"
    47 			"--records-from-stdin"
    48 			"--records-on-stdin"
    48 		)
    49 		)
    49 		COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0"))
    50 		COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0"))
    50 	fi
    51 	fi
    51 }
    52 }
    52 
    53