bash-completion.sh
branchv_0
changeset 27 d6d710336e7c
parent 25 0e8a58946c48
child 28 8f1da1ce3ca5
--- a/bash-completion.sh	Sat Dec 05 20:17:27 2020 +0100
+++ b/bash-completion.sh	Sun Dec 06 16:40:58 2020 +0100
@@ -59,6 +59,12 @@
 		"http://docbook.org/ns/docbook"
 	)
 
+	# TODO: introspection: after moving to alt2xml the available options and their values should be provided by the parser
+
+	PARSER_OPTIONS=(
+		"root-name"
+	);
+
 
 	if   [[ "$w1" == "--relation"                      && "x$w0" == "x" ]];    then COMPREPLY=("''")
 	elif [[ "$w1" == "--records"                       && "x$w0" == "x" ]];    then COMPREPLY=("'/'")
@@ -77,8 +83,8 @@
 	elif [[ "$w2" == "--raw-xml-attribute-wrapper"      && "x$w0" == "x" ]];    then COMPREPLY=("''")
 	elif [[ "$w3" == "--raw-xml-attribute-wrapper"      && "x$w0" == "x" ]];    then COMPREPLY=("''")
 
-	elif [[ "$w1" == "--parser-option"                                  ]];    then COMPREPLY=("''")
-	elif [[ "$w2" == "--parser-option"                 && "x$w0" == "x" ]];    then COMPREPLY=("''")
+	elif [[ "$w1" == "--parser-option"                                   ]];    then COMPREPLY=($(compgen -W "${PARSER_OPTIONS[*]}" -- "$w0"))
+	elif [[ "$w2" == "--parser-option"                  && "x$w0" == "x" ]];    then COMPREPLY=("''")
 
 	else
 		OPTIONS=(