completion: Drop unnecessary $ from variables in arithmetic expressions

It’s not needed, according to shellcheck.

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

View File

@ -22,7 +22,7 @@ __gdbus() {
local colon_word=${cur%${cur##*:}} local colon_word=${cur%${cur##*:}}
local i=${#COMPREPLY[*]} local i=${#COMPREPLY[*]}
while [ $((--i)) -ge 0 ]; do while [ $((--i)) -ge 0 ]; do
COMPREPLY[$i]=${COMPREPLY[$i]#"$colon_word"} COMPREPLY[i]=${COMPREPLY[i]#"$colon_word"}
done done
;; ;;
esac esac

View File

@ -109,7 +109,7 @@ __gio_location() {
__gio() { __gio() {
# Complete subcommands # Complete subcommands
if (( ${COMP_CWORD} == 1 )); then 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]}")) 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 compopt +o nospace
return 0 return 0

View File

@ -20,13 +20,13 @@ __gresource() {
coffset=0 coffset=0
fi fi
case "$((${COMP_CWORD}-$coffset))" in case "$((COMP_CWORD-coffset))" in
1) 1)
choices=$'--section \nhelp \nsections \nlist \ndetails \nextract ' choices=$'--section \nhelp \nsections \nlist \ndetails \nextract '
;; ;;
2) 2)
case "${COMP_WORDS[$(($coffset+1))]}" in case "${COMP_WORDS[$((coffset+1))]}" in
--section) --section)
return 0 return 0
;; ;;
@ -43,9 +43,9 @@ __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

@ -21,13 +21,13 @@ __gsettings() {
coffset=0 coffset=0
fi fi
case "$((${COMP_CWORD}-$coffset))" in case "$((COMP_CWORD-coffset))" in
1) 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 ' 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) 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
@ -51,21 +51,21 @@ __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
;; ;;
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]