bash-completion.sh
branchv_0
changeset 2 f031a4dc7c52
parent 0 16c7fa9b7c49
child 5 d70ea23682aa
equal deleted inserted replaced
1:3876a9c56a66 2:f031a4dc7c52
    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 	BOOLEAN_VALUES=(
       
    26 		"true"
       
    27 		"false"
       
    28 	)
       
    29 
    25 	if   [[ "$w1" == "--relation"                      && "x$w0" == "x" ]];    then COMPREPLY=("''")
    30 	if   [[ "$w1" == "--relation"                      && "x$w0" == "x" ]];    then COMPREPLY=("''")
       
    31 	elif [[ "$w1" == "--enable-sections"                                ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
       
    32 	elif [[ "$w1" == "--enable-subkeys"                                 ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
       
    33 	elif [[ "$w1" == "--enable-comments"                                ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
       
    34 	elif [[ "$w1" == "--enable-line-numbers"                            ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
       
    35 	elif [[ "$w1" == "--enable-event-numbers"                           ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    26 	else
    36 	else
    27 		OPTIONS=(
    37 		OPTIONS=(
    28 			"--relation"
    38 			"--relation"
       
    39 			"--enable-sections"
       
    40 			"--enable-subkeys"
       
    41 			"--enable-comments"
       
    42 			"--enable-line-numbers"
       
    43 			"--enable-event-numbers"
    29 		)
    44 		)
    30 		COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0"))
    45 		COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0"))
    31 	fi
    46 	fi
    32 }
    47 }
    33 
    48