/usr/share/bash-completion/completions/spatch is in coccinelle 1.0.4.deb-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | # Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2.
# Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2.
# Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2.
# This file is part of Coccinelle.
#
# Coccinelle is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, according to version 2 of the License.
#
# Coccinelle is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
#
# The authors reserve the right to distribute this or future versions of
# Coccinelle under other licenses.
#
# http://coccinelle.lip6.fr/
# From bash completion of git: __gitcomp_1
__spatchcomp_1 ()
{
local c IFS=' '$'\t'$'\n'
for c in $1; do
case "$c" in
-*) printf %s$'\n' "$c " ;;
*/) printf %s$'\n' "$c" ;;
*) printf %s$'\n' "$c " ;;
esac
done
}
_spatch()
{
local cur prev xspec
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
_spatch_options="--parse-cocci --sp-file -I --dir --patch
--iso-file --macro-file --macro-file-builtins
--in-place --out-place -h --help --shorthelp --longhelp -o --ignore-unknown-options
--use-glimpse --use-google --use-idutils
--include-headers --no-includes --all-includes --local-includes --preprocess
--quiet --very-quiet --debug --timeout --test"
if [[ $COMP_CWORD -eq 1 ]]; then
local IFS=$'\n'
COMPREPLY=( $(compgen -W "$(__spatchcomp_1 "${_spatch_options}")" -- $cur) )
return 0
fi
case "$prev" in
--parse-cocci|--sp-file)
xspec="!*.cocci"
;;
--iso-file)
xspec="!*.iso"
;;
--macro-file|--macro-file-builtins)
xspec="!*.h"
;;
-I|--dir|--patch)
xspec=""
;;
*)
xspec="!*.c"
;;
esac
if [[ "$xspec" == "" ]]; then
COMPREPLY=( $( compgen -d -o nospace -S '/' -- "$cur" ) )
elif [[ "$cur" == -* ]]; then
local IFS=$'\n'
COMPREPLY=( $(compgen -W "$(__spatchcomp_1 "${_spatch_options}")" -- $cur) )
elif [[ "$xspec" == "!*.c" ]]; then
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -o nospace -S '/' -- "$cur" ) )
else
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -o nospace -S '/' -- "$cur" ) )
fi
return 0
}
complete -F _spatch -o bashdefault -o default -o nospace spatch \
|| complete -F _spatch -o default -o nospace spatch
complete -F _spatch -o bashdefault -o default -o nospace spatch.opt \
|| complete -F _spatch -o default -o nospace spatch.opt
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh
|