Skip to content

Commit

Permalink
Update ssh.completion.sh ver5?
Browse files Browse the repository at this point in the history
Better version
  • Loading branch information
jornodberg authored Dec 12, 2024
1 parent 1f383ea commit 437a579
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion completions/ssh.completion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ function _omb_completion_ssh {
fi
done
if ((${#config_files[@]} != 0)); then
COMPREPLY+=( $(compgen -W "$(awk '/^[ \t]*[Hh][Oo][Ss][Tt][ \t=]+/ {gsub(/^[ \t]+|[ \t]+$/, ""); n=split($0, fields, /[ \t=]+/); for (i=2; i<=n; i++) if (fields[i] && !(fields[i] in hosts)) hosts[fields[i]]=1;} /^[ \t]*[Hh][Oo][Ss][Tt][Nn][Aa][Mm][Ee][ \t=]+/ {gsub(/^[ \t]+|[ \t]+$/, ""); n=split($0, fields, /[ \t=]+/); for (i=2; i<=n; i++) if (fields[i] && !(fields[i] in hosts)) hosts[fields[i]]=1;} /^[ \t]*$/ {current="";} END {for (host in hosts) print host;}' "${config_files[@]}")" "${options[@]}") )
COMPREPLY+=($(compgen -W "$(awk '
sub(/^[ \t]*[Hh][Oo][Ss][Tt]([Nn][Aa][Mm][Ee])?[ \t=]+/, "") {
n = split($0, fields, /[ \t]+/);
for (i = 1; i <= n; i++) if (fields[i] && !visited[fields[i]]++) print fields[i];
}' "${config_files[@]}")" "${options[@]}") )
fi

local -a known_hosts_files=()
Expand Down

0 comments on commit 437a579

Please sign in to comment.