bash-completion.sh
branchv_0
changeset 23 b497140b0b63
parent 6 fb717cfbfea1
child 24 07e0a2edf3bc
equal deleted inserted replaced
22:29d673a54ecf 23:b497140b0b63
    25 	BOOLEAN_VALUES=(
    25 	BOOLEAN_VALUES=(
    26 		"true"
    26 		"true"
    27 		"false"
    27 		"false"
    28 	)
    28 	)
    29 
    29 
       
    30 	PARSER_OPTIONS=(
       
    31 		"trim-continuing-lines"
       
    32 		"allow-section-tags"
       
    33 		"allow-sub-keys"
       
    34 		"comment-separators"
       
    35 		"key-value-separators"
       
    36 		"quotes"
       
    37 		"dialect"
       
    38 	);
       
    39 
       
    40 	DIALECTS=(
       
    41 		"default-ini"
       
    42 		"java-properties"
       
    43 	);
       
    44 
    30 	if   [[ "$w1" == "--relation"                      && "x$w0" == "x" ]];    then COMPREPLY=("''")
    45 	if   [[ "$w1" == "--relation"                      && "x$w0" == "x" ]];    then COMPREPLY=("''")
    31 	elif [[ "$w1" == "--enable-sections"                                ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    46 	elif [[ "$w1" == "--enable-sections"                                ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    32 	elif [[ "$w1" == "--enable-sub-keys"                                ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    47 	elif [[ "$w1" == "--enable-sub-keys"                                ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    33 	elif [[ "$w1" == "--enable-comments"                                ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    48 	elif [[ "$w1" == "--enable-comments"                                ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    34 	elif [[ "$w1" == "--enable-whitespace"                              ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    49 	elif [[ "$w1" == "--enable-whitespace"                              ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    35 	elif [[ "$w1" == "--enable-line-numbers"                            ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    50 	elif [[ "$w1" == "--enable-line-numbers"                            ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    36 	elif [[ "$w1" == "--enable-event-numbers"                           ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    51 	elif [[ "$w1" == "--enable-event-numbers"                           ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
       
    52 	elif [[ "$w1" == "--parser-option"                                  ]];    then COMPREPLY=($(compgen -W "${PARSER_OPTIONS[*]}" -- "$w0"))
       
    53 	elif [[ "$w2" == "--parser-option" && "$w1" == "trim-continuing-lines"                    ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
       
    54 	elif [[ "$w2" == "--parser-option" && "$w1" == "allow-section-tags"                       ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
       
    55 	elif [[ "$w2" == "--parser-option" && "$w1" == "allow-sub-keys"                           ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
       
    56 	elif [[ "$w2" == "--parser-option" && "$w1" == "dialect"                                  ]];    then COMPREPLY=($(compgen -W "${DIALECTS[*]}" -- "$w0"))
       
    57 	elif [[ "$w2" == "--parser-option" && "$w1" == "comment-separators"      && "x$w0" == "x" ]];    then COMPREPLY=("'#;'")
       
    58 	elif [[ "$w2" == "--parser-option" && "$w1" == "key-value-separators"    && "x$w0" == "x" ]];    then COMPREPLY=("'=:'")
       
    59 	elif [[ "$w2" == "--parser-option" && "$w1" == "quotes"                  && "x$w0" == "x" ]];    then COMPREPLY=("'\"\\''")
    37 	else
    60 	else
    38 		OPTIONS=(
    61 		OPTIONS=(
    39 			"--relation"
    62 			"--relation"
    40 			"--enable-sections"
    63 			"--enable-sections"
    41 			"--enable-sub-keys"
    64 			"--enable-sub-keys"
    42 			"--enable-comments"
    65 			"--enable-comments"
    43 			"--enable-whitespace"
    66 			"--enable-whitespace"
    44 			"--enable-line-numbers"
    67 			"--enable-line-numbers"
    45 			"--enable-event-numbers"
    68 			"--enable-event-numbers"
       
    69 			"--parser-option"
    46 		)
    70 		)
    47 		COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0"))
    71 		COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0"))
    48 	fi
    72 	fi
    49 }
    73 }
    50 
    74