Import Upstream version 2.72.4
This commit is contained in:
commit
4ef3ff9793
2003 changed files with 1332420 additions and 0 deletions
1
gio/completion/.gitignore
vendored
Normal file
1
gio/completion/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
!gio
|
||||
55
gio/completion/gapplication
Normal file
55
gio/completion/gapplication
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
|
||||
# Check for bash
|
||||
[ -z "$BASH_VERSION" ] && return
|
||||
|
||||
####################################################################################################
|
||||
|
||||
__app() {
|
||||
case "${COMP_CWORD}" in
|
||||
1)
|
||||
COMPREPLY=($(compgen -W "help version list-apps launch action list-actions" -- "${COMP_WORDS[1]}"))
|
||||
return 0
|
||||
;;
|
||||
|
||||
2)
|
||||
case "${COMP_WORDS[1]}" in
|
||||
launch|action|list-actions)
|
||||
COMPREPLY=($(compgen -W "`gapplication list-apps`" -- "${COMP_WORDS[2]}"))
|
||||
return 0
|
||||
;;
|
||||
|
||||
*)
|
||||
COMPREPLY=()
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
# Otherwise, what we will do is based on the command in ${COMP_WORDS[1]}
|
||||
case "${COMP_WORDS[1]}" in
|
||||
action)
|
||||
# Word 3 is the action name. This is the only one we can help with.
|
||||
if [ "${COMP_CWORD}" == 3 ]; then
|
||||
COMPREPLY=($(compgen -W "`gapplication list-actions "${COMP_WORDS[2]}"`" -- "${COMP_WORDS[3]}"))
|
||||
return 0
|
||||
else
|
||||
COMPREPLY=()
|
||||
return 0
|
||||
fi
|
||||
;;
|
||||
launch)
|
||||
# Filenames...
|
||||
COMPREPLY=($(compgen -A file "${COMP_WORDS[COMP_CWORD]}"))
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
# Nothing else should be out this far...
|
||||
COMPREPLY=()
|
||||
return 0
|
||||
esac
|
||||
}
|
||||
|
||||
####################################################################################################
|
||||
|
||||
complete -F __app gapplication
|
||||
33
gio/completion/gdbus
Normal file
33
gio/completion/gdbus
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
|
||||
# Check for bash
|
||||
[ -z "$BASH_VERSION" ] && return
|
||||
|
||||
####################################################################################################
|
||||
|
||||
|
||||
__gdbus() {
|
||||
local IFS=$'\n'
|
||||
local cur=`_get_cword :`
|
||||
|
||||
local suggestions=$(gdbus complete "${COMP_LINE}" ${COMP_POINT})
|
||||
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
|
||||
122
gio/completion/gio
Normal file
122
gio/completion/gio
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
#
|
||||
# Copyright (C) 2018 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/>.
|
||||
#
|
||||
|
||||
# Check for bash
|
||||
[ -z "$BASH_VERSION" ] && return
|
||||
|
||||
####################################################################################################
|
||||
|
||||
# Check whether the suggestions have common prefix (i.e. suggestions won't be
|
||||
# shown and prefix will be completed first)
|
||||
__gio_has_common_prefix() {
|
||||
local i
|
||||
for (( i = 1; i < ${#COMPREPLY[@]}; i++ )); do
|
||||
if [[ "${COMPREPLY[i-1]:${#cur}:1}" != "${COMPREPLY[i]:${#cur}:1}" ]]; then
|
||||
return 1 # False
|
||||
fi
|
||||
done
|
||||
|
||||
return 0 # True
|
||||
}
|
||||
|
||||
# Complete file location
|
||||
__gio_location() {
|
||||
# Prevent breaking on colons, we have to work with uris
|
||||
local cur
|
||||
_get_comp_words_by_ref -n : cur
|
||||
|
||||
# Resolve dirname for dir listing
|
||||
local dir=""
|
||||
if [[ $cur =~ "/"$ ]]; then
|
||||
dir="$cur"
|
||||
elif [[ $cur =~ "/" ]]; then
|
||||
# Subtract basename because dirname cmd doesn't work well with schemes
|
||||
dir=${cur%$(basename "$cur")}
|
||||
fi
|
||||
|
||||
# List volumes and mounts
|
||||
local mounts=( )
|
||||
local mount
|
||||
while IFS=$'\n' read mount; do
|
||||
# Do not care about local mounts
|
||||
[[ "$mount" =~ ^"file:" ]] && continue
|
||||
|
||||
# Use only matching mounts
|
||||
[[ "$mount" =~ ^"$cur" && "$mount" != "$cur" ]] && mounts+=("$mount")
|
||||
done < <(gio mount -li | sed -n -r 's/^ *(default_location|activation_root)=(.*)$/\2/p' | sort -u)
|
||||
|
||||
# Workaround to unescape dir name (e.g. "\ " -> " ")
|
||||
local -a tmp="( ${dir} )"
|
||||
local unescaped_dir="${tmp[0]}"
|
||||
|
||||
# List files
|
||||
local files=()
|
||||
local names=()
|
||||
local name size type
|
||||
while IFS=$'\t' read name size type; do
|
||||
# Escape name properly
|
||||
local escaped_name="$(printf "%q" "$name")"
|
||||
|
||||
# Append slash for directories and space for files
|
||||
if [[ "$type" == "(directory)" ]]; then
|
||||
escaped_name="$escaped_name/"
|
||||
else
|
||||
escaped_name="$escaped_name "
|
||||
fi
|
||||
|
||||
local path="$dir$escaped_name"
|
||||
|
||||
# Use only matching paths
|
||||
if [[ "$path" =~ ^"$cur" ]]; then
|
||||
files+=("$path")
|
||||
names+=("$escaped_name")
|
||||
fi
|
||||
done < <(gio list -hl "$unescaped_dir" 2> /dev/null)
|
||||
|
||||
COMPREPLY=("${files[@]}" "${mounts[@]}")
|
||||
|
||||
# Workaround to show suggestions as basenames only
|
||||
if ! __gio_has_common_prefix; then
|
||||
COMPREPLY=("${mounts[@]} ${names[@]}")
|
||||
|
||||
# Workaround to prevent overwriting suggestions, it adds empty
|
||||
# suggestion, otherwise names with colons will be corrupted
|
||||
COMPREPLY+=(" ")
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Workaround to complete names with colons, it removes colon prefix from
|
||||
# COMPREPLY
|
||||
__ltrim_colon_completions "$cur"
|
||||
}
|
||||
|
||||
__gio() {
|
||||
# Complete subcommands
|
||||
if (( ${COMP_CWORD} == 1 )); then
|
||||
COMPREPLY=($(compgen -W "help version cat copy info launch list mime mkdir monitor mount move open rename remove save set trash tree" -- "${COMP_WORDS[1]}"))
|
||||
compopt +o nospace
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Complete file locations
|
||||
__gio_location
|
||||
}
|
||||
|
||||
####################################################################################################
|
||||
|
||||
complete -o nospace -F __gio gio
|
||||
58
gio/completion/gresource
Normal file
58
gio/completion/gresource
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
|
||||
# Check for bash
|
||||
[ -z "$BASH_VERSION" ] && return
|
||||
|
||||
####################################################################################################
|
||||
|
||||
__gresource() {
|
||||
local choices coffset section
|
||||
|
||||
if [ ${COMP_CWORD} -gt 2 ]; then
|
||||
if [ ${COMP_WORDS[1]} = --section ]; then
|
||||
section=${COMP_WORDS[2]}
|
||||
coffset=2
|
||||
else
|
||||
coffset=0
|
||||
fi
|
||||
else
|
||||
coffset=0
|
||||
fi
|
||||
|
||||
case "$((${COMP_CWORD}-$coffset))" in
|
||||
1)
|
||||
choices=$'--section \nhelp \nsections \nlist \ndetails \nextract '
|
||||
;;
|
||||
|
||||
2)
|
||||
case "${COMP_WORDS[$(($coffset+1))]}" in
|
||||
--section)
|
||||
return 0
|
||||
;;
|
||||
|
||||
help)
|
||||
choices=$'sections\nlist\ndetails\nextract'
|
||||
;;
|
||||
|
||||
sections|list|details|extract)
|
||||
COMPREPLY=($(compgen -f -- ${COMP_WORDS[${COMP_CWORD}]}))
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
3)
|
||||
case "${COMP_WORDS[$(($coffset+1))]}" in
|
||||
list|details|extract)
|
||||
choices="$(gresource list ${COMP_WORDS[$(($coffset+2))]} 2> /dev/null | sed -e 's.$. .')"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
local IFS=$'\n'
|
||||
COMPREPLY=($(compgen -W "${choices}" -- "${COMP_WORDS[${COMP_CWORD}]}"))
|
||||
}
|
||||
|
||||
####################################################################################################
|
||||
|
||||
complete -o nospace -F __gresource gresource
|
||||
88
gio/completion/gsettings
Normal file
88
gio/completion/gsettings
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
|
||||
# Check for bash
|
||||
[ -z "$BASH_VERSION" ] && return
|
||||
|
||||
####################################################################################################
|
||||
|
||||
__gsettings() {
|
||||
local choices coffset schemadir
|
||||
|
||||
if [ ${COMP_CWORD} -gt 2 ]; then
|
||||
if [ ${COMP_WORDS[1]} = --schemadir ]; then
|
||||
# this complexity is needed to perform correct tilde expansion
|
||||
schemadir=$(eval "echo --schemadir ${COMP_WORDS[2]}")
|
||||
coffset=2
|
||||
else
|
||||
coffset=0
|
||||
fi
|
||||
else
|
||||
coffset=0
|
||||
fi
|
||||
|
||||
case "$((${COMP_CWORD}-$coffset))" in
|
||||
1)
|
||||
choices=$'--schemadir\n--version\nhelp \nlist-schemas\nlist-relocatable-schemas\nlist-keys \nlist-children \nlist-recursively \nget \nrange \nset \nreset \nreset-recursively \nwritable \nmonitor \ndescribe '
|
||||
;;
|
||||
|
||||
2)
|
||||
case "${COMP_WORDS[$(($coffset+1))]}" in
|
||||
--schemadir)
|
||||
COMPREPLY=($(compgen -o dirnames -- ${COMP_WORDS[${COMP_CWORD}]}))
|
||||
return 0
|
||||
;;
|
||||
|
||||
help)
|
||||
choices=$'list-schemas\nlist-relocatable-schemas\nlist-keys\nlist-children\nlist-recursively\nget\nrange\nset\nreset\nreset-recursively\nwritable\nmonitor'
|
||||
;;
|
||||
list-keys|list-children|list-recursively|reset-recursively)
|
||||
choices="$(gsettings $schemadir list-schemas 2> /dev/null)"$'\n'"$(gsettings $schemadir list-relocatable-schemas 2> /dev/null | sed -e 's.$.:/.')"
|
||||
;;
|
||||
list-schemas)
|
||||
COMPREPLY=($(compgen -W "--print-paths" -- ${COMP_WORDS[${COMP_CWORD}]}))
|
||||
return 0
|
||||
;;
|
||||
|
||||
get|range|set|reset|writable|monitor|describe)
|
||||
choices="$(gsettings $schemadir list-schemas 2> /dev/null | sed -e 's.$. .')"$'\n'"$(gsettings $schemadir list-relocatable-schemas 2> /dev/null | sed -e 's.$.:/.')"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
3)
|
||||
case "${COMP_WORDS[$(($coffset+1))]}" in
|
||||
set)
|
||||
choices="$(gsettings $schemadir list-keys ${COMP_WORDS[$(($coffset+2))]} 2> /dev/null | sed -e 's.$. .')"
|
||||
;;
|
||||
|
||||
get|range|reset|writable|monitor|describe)
|
||||
choices="$(gsettings $schemadir list-keys ${COMP_WORDS[$(($coffset+2))]} 2> /dev/null)"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
4)
|
||||
case "${COMP_WORDS[$(($coffset+2))]}" in
|
||||
set)
|
||||
range=($(gsettings $schemadir range ${COMP_WORDS[$(($coffset+2))]} ${COMP_WORDS[$(($coffset+3))]} 2> /dev/null))
|
||||
case "${range[0]}" in
|
||||
enum)
|
||||
unset range[0]
|
||||
;;
|
||||
*)
|
||||
unset range
|
||||
;;
|
||||
esac
|
||||
local IFS=$'\n'
|
||||
choices="${range[*]}"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
local IFS=$'\n'
|
||||
COMPREPLY=($(compgen -W "${choices}" -- "${COMP_WORDS[${COMP_CWORD}]}"))
|
||||
}
|
||||
|
||||
####################################################################################################
|
||||
|
||||
complete -o nospace -F __gsettings gsettings
|
||||
Loading…
Add table
Add a link
Reference in a new issue