diff options
author | Yuka Takahashi <yukatkh@gmail.com> | 2017-05-23 18:39:08 +0000 |
---|---|---|
committer | Yuka Takahashi <yukatkh@gmail.com> | 2017-05-23 18:39:08 +0000 |
commit | d7b775c00f12fbd46aa0680c744be13459300b9f (patch) | |
tree | 7546e688932fb468f836668942b6e77f05254994 /utils | |
parent | 0cb0ba28983d349395d2d38bdedcd9129ce556c4 (diff) |
[GSoC] Shell autocompletion for clang
Summary:
This is a first patch for GSoC project, bash-completion for clang.
To use this on bash, please run `source clang/utils/bash-autocomplete.sh`.
bash-autocomplete.sh is code for bash-completion.
Simple flag completion and path completion is available in this patch.
Reviewers: teemperor, v.g.vassilev, ruiu, Bigcheese, efriedma
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D33237
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303670 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/bash-autocomplete.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/utils/bash-autocomplete.sh b/utils/bash-autocomplete.sh new file mode 100644 index 0000000000..a906712514 --- /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 |