From a7ad2a4c3aee3804cd4a4933d337c6d41c60f6ad Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 16 Apr 2024 14:03:19 +0100 Subject: [PATCH] completion: Drop unnecessary $ from variables in arithmetic expressions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It’s not needed, according to shellcheck. Signed-off-by: Philip Withnall --- gio/completion/gdbus | 2 +- gio/completion/gio | 2 +- gio/completion/gresource | 8 ++++---- gio/completion/gsettings | 14 +++++++------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/gio/completion/gdbus b/gio/completion/gdbus index e7c3ad58d..abfb44256 100644 --- a/gio/completion/gdbus +++ b/gio/completion/gdbus @@ -22,7 +22,7 @@ __gdbus() { local colon_word=${cur%${cur##*:}} local i=${#COMPREPLY[*]} while [ $((--i)) -ge 0 ]; do - COMPREPLY[$i]=${COMPREPLY[$i]#"$colon_word"} + COMPREPLY[i]=${COMPREPLY[i]#"$colon_word"} done ;; esac diff --git a/gio/completion/gio b/gio/completion/gio index 2a27a8c39..4a4f4aff1 100644 --- a/gio/completion/gio +++ b/gio/completion/gio @@ -109,7 +109,7 @@ __gio_location() { __gio() { # 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]}")) compopt +o nospace return 0 diff --git a/gio/completion/gresource b/gio/completion/gresource index 915b4ab1c..fca4be4d2 100644 --- a/gio/completion/gresource +++ b/gio/completion/gresource @@ -20,13 +20,13 @@ __gresource() { coffset=0 fi - case "$((${COMP_CWORD}-$coffset))" in + case "$((COMP_CWORD-coffset))" in 1) choices=$'--section \nhelp \nsections \nlist \ndetails \nextract ' ;; 2) - case "${COMP_WORDS[$(($coffset+1))]}" in + case "${COMP_WORDS[$((coffset+1))]}" in --section) return 0 ;; @@ -43,9 +43,9 @@ __gresource() { ;; 3) - case "${COMP_WORDS[$(($coffset+1))]}" in + 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 ;; diff --git a/gio/completion/gsettings b/gio/completion/gsettings index 1cc4cbac4..87c3e3356 100644 --- a/gio/completion/gsettings +++ b/gio/completion/gsettings @@ -21,13 +21,13 @@ __gsettings() { coffset=0 fi - case "$((${COMP_CWORD}-$coffset))" in + 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 + case "${COMP_WORDS[$((coffset+1))]}" in --schemadir) COMPREPLY=($(compgen -o dirnames -- "${COMP_WORDS[${COMP_CWORD}]}")) return 0 @@ -51,21 +51,21 @@ __gsettings() { ;; 3) - case "${COMP_WORDS[$(($coffset+1))]}" in + 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 ;; 4) - case "${COMP_WORDS[$(($coffset+2))]}" in + 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]