aboutsummaryrefslogtreecommitdiffstats
path: root/src/_ccache
diff options
context:
space:
mode:
authorPaul Seyfert <pseyfert.mathphys@gmail.com>2018-06-15 10:53:32 +0200
committerPaul Seyfert <pseyfert.mathphys@gmail.com>2018-06-19 16:40:48 +0200
commit543c22cb6337041bde98064cbdbe890d4db6bec3 (patch)
tree4ddbc6e6ecfb76e941ed59d76ec27784dff885e3 /src/_ccache
parentMerge pull request #577 from pseyfert/c_standards (diff)
downloadzsh-completions-543c22cb6337041bde98064cbdbe890d4db6bec3.tar
zsh-completions-543c22cb6337041bde98064cbdbe890d4db6bec3.tar.gz
zsh-completions-543c22cb6337041bde98064cbdbe890d4db6bec3.tar.bz2
zsh-completions-543c22cb6337041bde98064cbdbe890d4db6bec3.tar.lz
zsh-completions-543c22cb6337041bde98064cbdbe890d4db6bec3.tar.xz
zsh-completions-543c22cb6337041bde98064cbdbe890d4db6bec3.tar.zst
zsh-completions-543c22cb6337041bde98064cbdbe890d4db6bec3.zip
add ccache completion
Diffstat (limited to 'src/_ccache')
-rw-r--r--src/_ccache66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/_ccache b/src/_ccache
new file mode 100644
index 0000000..a9dc010
--- /dev/null
+++ b/src/_ccache
@@ -0,0 +1,66 @@
+#compdef ccache
+# zsh completion script for ccache
+
+# Copyright 2018 CERN for the benefit of the LHCb Collaboration.
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# * Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# In applying this licence, CERN does not waive the privileges and immunities
+# granted to it by virtue of its status as an Intergovernmental Organization
+# or submit itself to any jurisdiction.
+
+# allow users to define their better compilers
+# inspired by _cmake_compilers
+# users could override with
+#
+# _ccache_compilers() {
+# local -a _ccache_compilers
+# _ccache_compilers=(gcc g++ clang clang++)
+# _wanted compilers expl "compiler" compadd -- $_ccache_compilers
+# }
+(( $+functions[_ccache_compilers] )) ||
+_ccache_compilers() {
+ _command_names -e
+}
+
+if [[ $words[2] == -* ]]; then
+ # if the first argument starts with -, we are in configure-ccache mode
+ # for this, _gnu_generic is okayish:
+ # * ccache --set-config=key=value won't complete beyond the first =
+ # * ccache --set-config=foo=bar --<TAB> won't suggest "set-config" another time
+ if [[ $words[$CURRENT] == -* ]]; then
+ # only call _gnu_generic without hyphen (files are not useful)
+ _gnu_generic
+ fi
+elif [[ $CURRENT -eq 2 ]]; then
+ _ccache_compilers
+else
+ # the command line already looks like 'ccache <compiler> ...'
+ # forward to the completion function of the compiler
+ (( CURRENT-- ))
+ shift words
+ _normal
+fi