completion: Add missing quoting

As suggested by shellcheck.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
Philip Withnall 2024-04-16 13:58:49 +01:00
parent aaf715a046
commit c79575362e
No known key found for this signature in database
GPG Key ID: DCDF5885B1F3ED73
3 changed files with 14 additions and 14 deletions

View File

@ -11,7 +11,7 @@ __gdbus() {
local IFS=$'\n'
local cur="$(_get_cword :)"
local suggestions=$(gdbus complete "${COMP_LINE}" ${COMP_POINT})
local suggestions="$(gdbus complete "${COMP_LINE}" "${COMP_POINT}")"
COMPREPLY=($(compgen -W "$suggestions" -- "$cur"))
# Remove colon-word prefix from COMPREPLY items

View File

@ -9,8 +9,8 @@
__gresource() {
local choices coffset section
if [ ${COMP_CWORD} -gt 2 ]; then
if [ ${COMP_WORDS[1]} = --section ]; then
if [ "${COMP_CWORD}" -gt 2 ]; then
if [ "${COMP_WORDS[1]}" = --section ]; then
section=${COMP_WORDS[2]}
coffset=2
else
@ -36,7 +36,7 @@ __gresource() {
;;
sections|list|details|extract)
COMPREPLY=($(compgen -f -- ${COMP_WORDS[${COMP_CWORD}]}))
COMPREPLY=($(compgen -f -- "${COMP_WORDS[${COMP_CWORD}]}"))
return 0
;;
esac
@ -45,7 +45,7 @@ __gresource() {
3)
case "${COMP_WORDS[$(($coffset+1))]}" in
list|details|extract)
choices="$(gresource list ${COMP_WORDS[$(($coffset+2))]} 2> /dev/null | sed -e 's.$. .')"
choices="$(gresource list "${COMP_WORDS[$(($coffset+2))]}" 2> /dev/null | sed -e 's.$. .')"
;;
esac
;;

View File

@ -9,8 +9,8 @@
__gsettings() {
local choices coffset schemadir=""
if [ ${COMP_CWORD} -gt 2 ]; then
if [ ${COMP_WORDS[1]} = --schemadir ]; then
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
@ -29,7 +29,7 @@ __gsettings() {
2)
case "${COMP_WORDS[$(($coffset+1))]}" in
--schemadir)
COMPREPLY=($(compgen -o dirnames -- ${COMP_WORDS[${COMP_CWORD}]}))
COMPREPLY=($(compgen -o dirnames -- "${COMP_WORDS[${COMP_CWORD}]}"))
return 0
;;
@ -37,15 +37,15 @@ __gsettings() {
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.$.:/.')"
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}]}))
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.$.:/.')"
choices="$(gsettings "$schemadir" list-schemas 2> /dev/null | sed -e 's.$. .')"$'\n'"$(gsettings "$schemadir" list-relocatable-schemas 2> /dev/null | sed -e 's.$.:/.')"
;;
esac
;;
@ -53,11 +53,11 @@ __gsettings() {
3)
case "${COMP_WORDS[$(($coffset+1))]}" in
set)
choices="$(gsettings $schemadir list-keys ${COMP_WORDS[$(($coffset+2))]} 2> /dev/null | sed -e 's.$. .')"
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)"
choices="$(gsettings "$schemadir" list-keys "${COMP_WORDS[$(($coffset+2))]}" 2> /dev/null)"
;;
esac
;;
@ -65,7 +65,7 @@ __gsettings() {
4)
case "${COMP_WORDS[$(($coffset+2))]}" in
set)
range=($(gsettings $schemadir range ${COMP_WORDS[$(($coffset+2))]} ${COMP_WORDS[$(($coffset+3))]} 2> /dev/null))
range=($(gsettings "$schemadir" range "${COMP_WORDS[$(($coffset+2))]}" "${COMP_WORDS[$(($coffset+3))]}" 2> /dev/null))
case "${range[0]}" in
enum)
unset range[0]