From d3d811f4e54427a2a409dd04c8573a9f30c9143d Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 16 Apr 2024 14:05:04 +0100 Subject: [PATCH] completion: Split declaration and assignment of variables Having them on the same line masks failure of the subcommand generating the value being assigned. Spotted by shellcheck. Signed-off-by: Philip Withnall --- gio/completion/gdbus | 6 ++++-- gio/completion/gio | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gio/completion/gdbus b/gio/completion/gdbus index abfb44256..fea093271 100644 --- a/gio/completion/gdbus +++ b/gio/completion/gdbus @@ -9,9 +9,11 @@ __gdbus() { local IFS=$'\n' - local cur="$(_get_cword :)" + local cur + cur="$(_get_cword :)" - local suggestions="$(gdbus complete "${COMP_LINE}" "${COMP_POINT}")" + local suggestions + suggestions="$(gdbus complete "${COMP_LINE}" "${COMP_POINT}")" COMPREPLY=($(compgen -W "$suggestions" -- "$cur")) # Remove colon-word prefix from COMPREPLY items diff --git a/gio/completion/gio b/gio/completion/gio index 4a4f4aff1..590dd53ee 100644 --- a/gio/completion/gio +++ b/gio/completion/gio @@ -71,7 +71,8 @@ __gio_location() { local name size type while IFS=$'\t' read name size type; do # Escape name properly - local escaped_name="$(printf "%q" "$name")" + local escaped_name + escaped_name="$(printf "%q" "$name")" # Append slash for directories and space for files if [[ "$type" == "(directory)" ]]; then