bash-completion.sh
branchv_0
changeset 40 85b6f13f1088
parent 0 bfee08a31fdc
child 41 12acb6c02d32
equal deleted inserted replaced
39:6ef41443211e 40:85b6f13f1088
    57 		"http://www.w3.org/2000/svg"
    57 		"http://www.w3.org/2000/svg"
    58 		"http://www.w3.org/2005/Atom"
    58 		"http://www.w3.org/2005/Atom"
    59 		"http://docbook.org/ns/docbook"
    59 		"http://docbook.org/ns/docbook"
    60 	)
    60 	)
    61 
    61 
       
    62 	# TODO: introspection: after moving to alt2xml the available options and their values should be provided by the parser
       
    63 
       
    64 	PARSER_OPTIONS=(
       
    65 		"encoding"
       
    66 		"parse-encapsulated"
       
    67 		"tree-style"
       
    68 		"tree-with-namespaces"
       
    69 		"root-name"
       
    70 	);
       
    71 
       
    72 	ENCODINGS=(
       
    73 		"BER"
       
    74 		"DER"
       
    75 		"CER"
       
    76 		"PER"
       
    77 		"XER"
       
    78 		"ASN.1"
       
    79 	);
       
    80 
       
    81 	TREE_STYLES=(
       
    82 		"standard"
       
    83 		"literal"
       
    84 	)
       
    85 
    62 
    86 
    63 	if   [[ "$w1" == "--relation"                      && "x$w0" == "x" ]];    then COMPREPLY=("''")
    87 	if   [[ "$w1" == "--relation"                      && "x$w0" == "x" ]];    then COMPREPLY=("''")
    64 	elif [[ "$w1" == "--records"                       && "x$w0" == "x" ]];    then COMPREPLY=("'/'")
    88 	elif [[ "$w1" == "--records"                       && "x$w0" == "x" ]];    then COMPREPLY=("'/'")
    65 	elif [[ "$w1" == "--attribute"                     && "x$w0" == "x" ]];    then COMPREPLY=("''")
    89 	elif [[ "$w1" == "--attribute"                     && "x$w0" == "x" ]];    then COMPREPLY=("''")
    66 	elif [[ "$w2" == "--attribute"                                      ]];    then COMPREPLY=($(compgen -W "${DATA_TYPE[*]}" -- "$w0"))
    90 	elif [[ "$w2" == "--attribute"                                      ]];    then COMPREPLY=($(compgen -W "${DATA_TYPE[*]}" -- "$w0"))
    75 
    99 
    76 	elif [[ "$w1" == "--raw-xml-attribute-wrapper"                       ]];    then COMPREPLY=("'attribute'")
   100 	elif [[ "$w1" == "--raw-xml-attribute-wrapper"                       ]];    then COMPREPLY=("'attribute'")
    77 	elif [[ "$w2" == "--raw-xml-attribute-wrapper"      && "x$w0" == "x" ]];    then COMPREPLY=("''")
   101 	elif [[ "$w2" == "--raw-xml-attribute-wrapper"      && "x$w0" == "x" ]];    then COMPREPLY=("''")
    78 	elif [[ "$w3" == "--raw-xml-attribute-wrapper"      && "x$w0" == "x" ]];    then COMPREPLY=("''")
   102 	elif [[ "$w3" == "--raw-xml-attribute-wrapper"      && "x$w0" == "x" ]];    then COMPREPLY=("''")
    79 
   103 
    80 	elif [[ "$w1" == "--parser-option"                                  ]];    then COMPREPLY=("''")
   104 	elif [[ "$w1" == "--parser-option"                                                        ]];    then COMPREPLY=($(compgen -W "${PARSER_OPTIONS[*]}" -- "$w0"))
    81 	elif [[ "$w2" == "--parser-option"                 && "x$w0" == "x" ]];    then COMPREPLY=("''")
   105 	elif [[ "$w2" == "--parser-option" && "$w1" == "encoding"                                 ]];    then COMPREPLY=($(compgen -W "${ENCODINGS[*]}" -- "$w0"))
    82 
   106 	elif [[ "$w2" == "--parser-option" && "$w1" == "parse-encapsulated"                       ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
       
   107 	elif [[ "$w2" == "--parser-option" && "$w1" == "tree-style"                               ]];    then COMPREPLY=($(compgen -W "${TREE_STYLES[*]}" -- "$w0"))
       
   108 	elif [[ "$w2" == "--parser-option" && "$w1" == "tree-with-namespaces"                     ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
       
   109 	elif [[ "$w2" == "--parser-option" && "$w1" == "root-name"               && "x$w0" == "x" ]];    then COMPREPLY=("'asn1'")
       
   110 	
    83 	else
   111 	else
    84 		OPTIONS=(
   112 		OPTIONS=(
    85 			"--namespace"
   113 			"--namespace"
    86 			"--parser-option"
   114 			"--parser-option"
    87 			"--relation"
   115 			"--relation"