__fish_print_hostnames: skip ssh host definitions containing wildcards

This commit is contained in:
exploide 2020-05-11 18:25:49 +02:00 committed by Johannes Altmanninger
parent f71737e58a
commit 1ccec532f0

View File

@ -109,7 +109,7 @@ function __fish_print_hostnames -d "Print a list of known hostnames"
# Print hosts from system wide ssh configuration file # Print hosts from system wide ssh configuration file
# Multiple names for a single host can be given separated by spaces, so just split it explicitly (#6698). # Multiple names for a single host can be given separated by spaces, so just split it explicitly (#6698).
string replace -rfi '^\s*Host\s+(\S.*?)\s*$' '$1' -- $contents | string split " " | string match -v '*\**' string replace -rfi '^\s*Host\s+(\S.*?)\s*$' '$1' -- $contents | string split " " | string match -rv '[\*\?]'
# Also extract known_host paths. # Also extract known_host paths.
set known_hosts $known_hosts (string replace -rfi '.*KnownHostsFile\s*' '' -- $contents) set known_hosts $known_hosts (string replace -rfi '.*KnownHostsFile\s*' '' -- $contents)
end end