summaryrefslogtreecommitdiff
path: root/utils/bash-autocomplete.sh
diff options
context:
space:
mode:
Diffstat (limited to 'utils/bash-autocomplete.sh')
-rwxr-xr-xutils/bash-autocomplete.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/utils/bash-autocomplete.sh b/utils/bash-autocomplete.sh
new file mode 100755
index 0000000000000..de4a435b8849f
--- /dev/null
+++ b/utils/bash-autocomplete.sh
@@ -0,0 +1,14 @@
+# Please add "source /path/to/bash-autocomplete.sh" to your .bashrc to use this.
+_clang()
+{
+ local cur prev words cword flags
+ _init_completion -n : || return
+
+ flags=$( clang --autocomplete="$cur" )
+ if [[ "$flags" == "" || "$cur" == "" ]]; then
+ _filedir
+ else
+ COMPREPLY=( $( compgen -W "$flags" -- "$cur" ) )
+ fi
+}
+complete -F _clang clang