Update __fish_print_hostnames.fish

There was an issue in autocomplete of ssh. 

When you put in ~/.ssh/config line like this:

"Include Include ${HRL_SSH}/onprem_config"

and then trying to use fish complete for ssh, for example:

"ssh -J" and press key <Tab> it throughs an error that fish cannot understand ${HRL_SSH} with brackets.
This commit is contained in:
Azamat Dinaev
2025-07-12 14:18:43 +03:00
committed by GitHub
parent f4ddcfa694
commit eb7afd2a9c

View File

@@ -76,6 +76,11 @@ function __fish_print_hostnames -d "Print a list of known hostnames"
set -l new_paths
for path in $paths
# while ssh_config is using brackets to resolve env, they should be removed
# example
# in ssh_config: ${SOME_PATH}
# in fish: $SOME_PATH
set path (string replace -r '\${([^}]+)}' '$1' $path)
set -l expanded_path
# Scope "relative" paths in accordance to ssh path resolution
if string match -qrv '^[~/]' $path