bash-completion.sh
branchv_0
changeset 30 8c3fe9af6066
parent 24 07e0a2edf3bc
child 31 bdf04cd91308
equal deleted inserted replaced
29:f0bf2755249f 30:8c3fe9af6066
    25 	BOOLEAN_VALUES=(
    25 	BOOLEAN_VALUES=(
    26 		"true"
    26 		"true"
    27 		"false"
    27 		"false"
    28 	)
    28 	)
    29 
    29 
       
    30 	# TODO: introspection: after moving to alt2xml the available options and their values should be provided by the parser
       
    31 
    30 	PARSER_OPTIONS=(
    32 	PARSER_OPTIONS=(
    31 		"trim-continuing-lines"
    33 		"trim-continuing-lines"
    32 		"allow-sections"
    34 		"allow-sections"
    33 		"allow-section-tags"
    35 		"allow-section-tags"
    34 		"allow-sub-keys"
    36 		"allow-sub-keys"
    35 		"comment-separators"
    37 		"comment-separators"
    36 		"key-value-separators"
    38 		"key-value-separators"
    37 		"quotes"
    39 		"quotes"
    38 		"dialect"
    40 		"dialect"
       
    41 		"unescape-basic"
       
    42 		"unescape-java-properties"
       
    43 		"unescape-backspace"
    39 	);
    44 	);
    40 
    45 
    41 	DIALECTS=(
    46 	DIALECTS=(
    42 		"default-ini"
       
    43 		"java-properties"
    47 		"java-properties"
    44 	);
    48 	);
    45 
    49 
    46 	if   [[ "$w1" == "--relation"                      && "x$w0" == "x" ]];    then COMPREPLY=("''")
    50 	if   [[ "$w1" == "--relation"                      && "x$w0" == "x" ]];    then COMPREPLY=("''")
    47 	elif [[ "$w1" == "--enable-sections"                                ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    51 	elif [[ "$w1" == "--enable-sections"                                ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    53 	elif [[ "$w1" == "--parser-option"                                  ]];    then COMPREPLY=($(compgen -W "${PARSER_OPTIONS[*]}" -- "$w0"))
    57 	elif [[ "$w1" == "--parser-option"                                  ]];    then COMPREPLY=($(compgen -W "${PARSER_OPTIONS[*]}" -- "$w0"))
    54 	elif [[ "$w2" == "--parser-option" && "$w1" == "trim-continuing-lines"                    ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    58 	elif [[ "$w2" == "--parser-option" && "$w1" == "trim-continuing-lines"                    ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    55 	elif [[ "$w2" == "--parser-option" && "$w1" == "allow-sections"                           ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    59 	elif [[ "$w2" == "--parser-option" && "$w1" == "allow-sections"                           ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    56 	elif [[ "$w2" == "--parser-option" && "$w1" == "allow-section-tags"                       ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    60 	elif [[ "$w2" == "--parser-option" && "$w1" == "allow-section-tags"                       ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    57 	elif [[ "$w2" == "--parser-option" && "$w1" == "allow-sub-keys"                           ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    61 	elif [[ "$w2" == "--parser-option" && "$w1" == "allow-sub-keys"                           ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
       
    62 	elif [[ "$w2" == "--parser-option" && "$w1" == "unescape-basic"                           ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
       
    63 	elif [[ "$w2" == "--parser-option" && "$w1" == "unescape-java-properties"                 ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
       
    64 	elif [[ "$w2" == "--parser-option" && "$w1" == "unescape-backspace"                       ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    58 	elif [[ "$w2" == "--parser-option" && "$w1" == "dialect"                                  ]];    then COMPREPLY=($(compgen -W "${DIALECTS[*]}" -- "$w0"))
    65 	elif [[ "$w2" == "--parser-option" && "$w1" == "dialect"                                  ]];    then COMPREPLY=($(compgen -W "${DIALECTS[*]}" -- "$w0"))
    59 	elif [[ "$w2" == "--parser-option" && "$w1" == "comment-separators"      && "x$w0" == "x" ]];    then COMPREPLY=("'#;'")
    66 	elif [[ "$w2" == "--parser-option" && "$w1" == "comment-separators"      && "x$w0" == "x" ]];    then COMPREPLY=("'#;'")
    60 	elif [[ "$w2" == "--parser-option" && "$w1" == "key-value-separators"    && "x$w0" == "x" ]];    then COMPREPLY=("'=:'")
    67 	elif [[ "$w2" == "--parser-option" && "$w1" == "key-value-separators"    && "x$w0" == "x" ]];    then COMPREPLY=("'=:'")
    61 	elif [[ "$w2" == "--parser-option" && "$w1" == "quotes"                  && "x$w0" == "x" ]];    then COMPREPLY=("'\"\\''")
    68 	elif [[ "$w2" == "--parser-option" && "$w1" == "quotes"                  && "x$w0" == "x" ]];    then COMPREPLY=("'\"\\''")
    62 	else
    69 	else