From 2b4f61f2944205eaf2f3aeeb876d58121f1cb862 Mon Sep 17 00:00:00 2001 From: Dale Eidd Date: Tue, 6 Jun 2017 15:00:40 +0800 Subject: [PATCH] Fix echo "no wildcard match" complaints for ssh completions etc --- share/functions/__fish_print_hostnames.fish | 24 +++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/share/functions/__fish_print_hostnames.fish b/share/functions/__fish_print_hostnames.fish index 98cf08186..dcf6ffd49 100644 --- a/share/functions/__fish_print_hostnames.fish +++ b/share/functions/__fish_print_hostnames.fish @@ -59,17 +59,23 @@ function __fish_print_hostnames -d "Print a list of known hostnames" # Normalize whitespace | string trim | string replace -r -a '\s+' ' ') end - if test -n "$paths" - # Expand paths which may have globbing and tokenize - set paths (eval "echo $paths" | string split ' ') - for path_index in (seq (count $paths)) - # Resolve relative paths - if string match -v '/*' $paths[$path_index] >/dev/null - set paths[$path_index] $relative_path/$paths[$path_index] + + set -l new_paths + for path in $paths + set -l expanded_path + eval set expanded_path (echo $path) + for path in $expanded_path + # Resolve "relative" paths in accordance to ssh path resolution + if string match -qv '/*' $path + set path $relative_path/$path end - echo $paths[$path_index] + echo $path + set new_paths $new_paths $path end - _recursive $paths + end + + if test -n "$new_paths"; + _recursive $new_paths end end _recursive $ssh_config