glib/gio/completion/gdbus
Philip Withnall 295a6fb965
completion: Add missing copyright and licensing headers
The copyright entries come from looking at `git log gio/completion/*`
and, in particular, `git log -- gio/gsettings-bash-completion.sh` (etc.)
as the files were moved after being originally written, and haven’t
really changed since.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #1415
2024-04-17 17:43:44 +01:00

59 lines
1.8 KiB
Plaintext

#
# Copyright 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
# licence, or (at your option) any later version.
#
# This 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, see <http://www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: LGPL-2.1-or-later
# shellcheck shell=bash
# Check for bash
[ -z "$BASH_VERSION" ] && return
####################################################################################################
__gdbus() {
local gdbus_binary
gdbus_binary="$1"
local IFS=$'\n'
local cur
cur="$(_get_cword :)"
local suggestions
suggestions="$("$gdbus_binary" complete "${COMP_LINE}" "${COMP_POINT}")"
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$suggestions" -- "$cur"))
# Remove colon-word prefix from COMPREPLY items
case "$cur" in
*:*)
case "$COMP_WORDBREAKS" in
*:*)
local colon_word=${cur%"${cur##*:}"}
local i=${#COMPREPLY[*]}
while [ $((--i)) -ge 0 ]; do
COMPREPLY[i]=${COMPREPLY[i]#"$colon_word"}
done
;;
esac
;;
esac
}
####################################################################################################
complete -o nospace -F __gdbus gdbus