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
3 changed files with 14 additions and 14 deletions

View File

@@ -11,7 +11,7 @@ __gdbus() {
local IFS=$'\n' local IFS=$'\n'
local cur="$(_get_cword :)" 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")) COMPREPLY=($(compgen -W "$suggestions" -- "$cur"))
# Remove colon-word prefix from COMPREPLY items # Remove colon-word prefix from COMPREPLY items

View File

@@ -9,8 +9,8 @@
__gresource() { __gresource() {
local choices coffset section local choices coffset section
if [ ${COMP_CWORD} -gt 2 ]; then if [ "${COMP_CWORD}" -gt 2 ]; then
if [ ${COMP_WORDS[1]} = --section ]; then if [ "${COMP_WORDS[1]}" = --section ]; then
section=${COMP_WORDS[2]} section=${COMP_WORDS[2]}
coffset=2 coffset=2
else else
@@ -36,7 +36,7 @@ __gresource() {
;; ;;
sections|list|details|extract) sections|list|details|extract)
COMPREPLY=($(compgen -f -- ${COMP_WORDS[${COMP_CWORD}]})) COMPREPLY=($(compgen -f -- "${COMP_WORDS[${COMP_CWORD}]}"))
return 0 return 0
;; ;;
esac esac
@@ -45,7 +45,7 @@ __gresource() {
3) 3)
case "${COMP_WORDS[$(($coffset+1))]}" in case "${COMP_WORDS[$(($coffset+1))]}" in
list|details|extract) 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 esac
;; ;;

View File

@@ -9,8 +9,8 @@
__gsettings() { __gsettings() {
local choices coffset schemadir="" local choices coffset schemadir=""
if [ ${COMP_CWORD} -gt 2 ]; then if [ "${COMP_CWORD}" -gt 2 ]; then
if [ ${COMP_WORDS[1]} = --schemadir ]; then if [ "${COMP_WORDS[1]}" = --schemadir ]; then
# this complexity is needed to perform correct tilde expansion # this complexity is needed to perform correct tilde expansion
schemadir=$(eval "echo --schemadir ${COMP_WORDS[2]}") schemadir=$(eval "echo --schemadir ${COMP_WORDS[2]}")
coffset=2 coffset=2
@@ -29,7 +29,7 @@ __gsettings() {
2) 2)
case "${COMP_WORDS[$(($coffset+1))]}" in case "${COMP_WORDS[$(($coffset+1))]}" in
--schemadir) --schemadir)
COMPREPLY=($(compgen -o dirnames -- ${COMP_WORDS[${COMP_CWORD}]})) COMPREPLY=($(compgen -o dirnames -- "${COMP_WORDS[${COMP_CWORD}]}"))
return 0 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' 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) 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) list-schemas)
COMPREPLY=($(compgen -W "--print-paths" -- ${COMP_WORDS[${COMP_CWORD}]})) COMPREPLY=($(compgen -W "--print-paths" -- "${COMP_WORDS[${COMP_CWORD}]}"))
return 0 return 0
;; ;;
get|range|set|reset|writable|monitor|describe) 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 esac
;; ;;
@@ -53,11 +53,11 @@ __gsettings() {
3) 3)
case "${COMP_WORDS[$(($coffset+1))]}" in case "${COMP_WORDS[$(($coffset+1))]}" in
set) 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) 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 esac
;; ;;
@@ -65,7 +65,7 @@ __gsettings() {
4) 4)
case "${COMP_WORDS[$(($coffset+2))]}" in case "${COMP_WORDS[$(($coffset+2))]}" in
set) 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 case "${range[0]}" in
enum) enum)
unset range[0] unset range[0]