From ff987f5f76918fa94acbd31002ecaab9e6f46712 Mon Sep 17 00:00:00 2001 From: Sam Doran Date: Sat, 19 Apr 2025 00:52:31 -0400 Subject: [PATCH] Do not use test for evaluating string match Also add `--` to ensure parameters don't get mixed up with the line itself. --- share/completions/tmutil.fish | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/share/completions/tmutil.fish b/share/completions/tmutil.fish index 73423c11f..3cac08fbb 100644 --- a/share/completions/tmutil.fish +++ b/share/completions/tmutil.fish @@ -2,7 +2,7 @@ function __destination_ids for line in $(tmutil destinationinfo) - if test -n "$(string match '*===*' $line)" + if string match -q '*===*' -- $line # New section so clear out variables set -f name '' set -f ID '' @@ -10,19 +10,19 @@ function __destination_ids continue end - if test -n "$(string match -r '^Name' $line)" + if string match -q -r '^Name' -- $line # Got the destination name set -f name "$(string match -r -g '^Name\s+:\s+(.*)$' $line | string trim)" continue end - if test -n "$(string match -r '^Kind' $line)" + if string match -q -r '^Kind' -- $line # Got the destination name set -f kind "$(string match -r -g '^Kind\s+:\s+(\w+)' $line | string trim)" continue end - if test -n "$(string match -r '^ID' $line)" + if string match -q -r '^ID' -- $line # Got the destination ID set -f ID "$(string match -r -g '^ID\s+:\s+(.*)$' $line | string trim)" echo "$ID\t'$name $kind'"