bash-completion.sh
branchv_0
changeset 5 dbf093b8b9ac
parent 0 17fc678e0a94
equal deleted inserted replaced
4:e5baa07d6e60 5:dbf093b8b9ac
    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 	WRITE_HEADER=(
    25 	BOOLEAN_VALUES=(
    26 		"true"
    26 		"true"
    27 		"false"
    27 		"false"
    28 	)
    28 	)
    29 
    29 
    30 	if [[ "$w1" == "--TODO"                                            ]];    then COMPREPLY=($(compgen -W "${WRITE_HEADER[*]}" -- "$w0"))
    30 	  if [[ "$w1" == "--debug"                                          ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
       
    31 	elif [[ "$w1" == "--dry-run"                                        ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    31 	else
    32 	else
    32 		OPTIONS=(
    33 		OPTIONS=(
    33 			"--TODO"
    34 			"--debug"
       
    35 			"--dry-run"
    34 		)
    36 		)
    35 		COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0"))
    37 		COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0"))
    36 	fi
    38 	fi
    37 }
    39 }
    38 
    40