/usr/share/bash-completion/completions/ibus.bash is in ibus 1.5.17-3ubuntu4.
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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | # vim:set et ts=4 sts=4:
# bash completion for ibus
#
# ibus - The Input Bus
#
# Copyright (c) 2007-2010 Peng Huang <shawn.p.huang@gmail.com>
# Copyright (c) 2007-2010 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA
if ! type _get_comp_words_by_ref >/dev/null 2>&1; then
if [[ -z ${ZSH_VERSION:+set} ]]; then
_get_comp_words_by_ref ()
{
local exclude cur_ words_ cword_
if [ "$1" = "-n" ]; then
exclude=$2
shift 2
fi
__git_reassemble_comp_words_by_ref "$exclude"
cur_=${words_[cword_]}
while [ $# -gt 0 ]; do
case "$1" in
cur)
cur=$cur_
;;
prev)
prev=${words_[$cword_-1]}
;;
words)
words=("${words_[@]}")
;;
cword)
cword=$cword_
;;
esac
shift
done
}
else
_get_comp_words_by_ref ()
{
while [ $# -gt 0 ]; do
case "$1" in
cur)
cur=${COMP_WORDS[COMP_CWORD]}
;;
prev)
prev=${COMP_WORDS[COMP_CWORD-1]}
;;
words)
words=("${COMP_WORDS[@]}")
;;
cword)
cword=$COMP_CWORD
;;
-n)
# assume COMP_WORDBREAKS is already set sanely
shift
;;
esac
shift
done
}
fi
fi
__ibus_engine()
{
if [[ "$cmd" == "$prev" ]]; then
local imes=$( ibus list-engine --name-only 2>/dev/null )
COMPREPLY=( $( compgen -W "$imes" -- "$cur" | sed "s/^$cur/$cur_/" ))
fi
}
__ibus_list_engine()
{
if [[ "$cur" == -* ]]; then
local options=( --name-only )
COMPREPLY=( $( compgen -W '${options[@]}' -- "$cur" ))
fi
}
__ibus()
{
COMPREPLY=()
local cur_=$2 prev_=$3 cur words cword prev
_get_comp_words_by_ref -n =: cur words cword prev
# echo
# echo "cur='$cur'"
# echo "prev='$prev'"
# echo "words='${words[@]}'"
# echo "cwords='${cwords[@]}'"
# Commands
local cmds=( engine list-engine watch restart exit )
local i c cmd subcmd
for (( i=1; i < ${#words[@]}-1; i++)) ; do
[[ -n $cmd ]] && subcmd=${words[i]} && break
for c in ${cmds[@]}; do
[[ ${words[i]} == $c ]] && cmd=$c && break
done
done
case $cmd in
engine)
__ibus_engine;
return 0
;;
list-engine)
__ibus_list_engine;
return 0
;;
watch)
return 0
;;
*)
COMPREPLY=( $( compgen -W '${cmds[@]}' -- "$cur" ))
return 0
;;
esac
} &&
complete -o bashdefault -o default -o nospace -F __ibus ibus
|