forked from llvm-mirror/clang
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information
1 parent
0cb0ba2
commit d7b775c
Showing
5 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// RUN: %clang --autocomplete=-fsyn | FileCheck %s -check-prefix=FSYN | ||
// FSYN: -fsyntax-only | ||
// RUN: %clang --autocomplete=-s | FileCheck %s -check-prefix=STD | ||
// STD: -std={{.*}}-stdlib= | ||
// RUN: %clang --autocomplete=foo | not FileCheck %s -check-prefix=NONE | ||
// NONE: foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |