Skip to content

Commit

Permalink
Update ssh.completion.sh to be case-insensitive (#645)
Browse files Browse the repository at this point in the history
completions/ssh: identify Host/Hostname directives case-insensitively

Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
  • Loading branch information
jornodberg and akinomyoga authored Dec 30, 2024
1 parent 21b6c45 commit c88bc28
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 '/^Host/ {for (i=2; i<=NF; i++) print $i}' "${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 c88bc28

Please sign in to comment.