mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-02 05:02:04 -07:00
[bash,zsh] Support "=" after "Hostname" and "Host" in ~/.ssh/config
In ~/.ssh/config, "=" can also be used as a separator between the field name and the value. The current master does not properly handle this and generate a hostname "=" or one starting with "=". This patch correctly handles it.
This commit is contained in:
committed by
Junegunn Choi
parent
4a61f53b85
commit
2bd29c3172
@@ -494,8 +494,12 @@ if ! declare -F __fzf_list_hosts > /dev/null; then
|
|||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
__fzf_exec_awk '
|
__fzf_exec_awk '
|
||||||
tolower($1) ~ /^host(name)?$/ {
|
# Note: mawk <= 1.3.3-20090705 does not support the POSIX brackets of
|
||||||
for (i = 2; i <= NF; i++)
|
# the form [[:blank:]], and Ubuntu 18.04 LTS still uses this
|
||||||
|
# 16-year-old mawk unfortunately. We need to use [ \t] instead.
|
||||||
|
match(tolower($0), /^[ \t]*host(name)?[ \t]*[ \t=]/) {
|
||||||
|
$0 = substr($0, RLENGTH + 1) # Remove "Host(name)?=?"
|
||||||
|
for (i = 1; i <= NF; i++)
|
||||||
if ($i !~ /[*?%]/)
|
if ($i !~ /[*?%]/)
|
||||||
print $i
|
print $i
|
||||||
}
|
}
|
||||||
|
@@ -272,8 +272,12 @@ if ! declare -f __fzf_list_hosts > /dev/null; then
|
|||||||
setopt GLOB NO_DOT_GLOB CASE_GLOB NO_NOMATCH NULL_GLOB
|
setopt GLOB NO_DOT_GLOB CASE_GLOB NO_NOMATCH NULL_GLOB
|
||||||
|
|
||||||
__fzf_exec_awk '
|
__fzf_exec_awk '
|
||||||
tolower($1) ~ /^host(name)?$/ {
|
# Note: mawk <= 1.3.3-20090705 does not support the POSIX brackets of
|
||||||
for (i = 2; i <= NF; i++)
|
# the form [[:blank:]], and Ubuntu 18.04 LTS still uses this
|
||||||
|
# 16-year-old mawk unfortunately. We need to use [ \t] instead.
|
||||||
|
match(tolower($0), /^[ \t]*host(name)?[ \t]*[ \t=]/) {
|
||||||
|
$0 = substr($0, RLENGTH + 1) # Remove "Host(name)?=?"
|
||||||
|
for (i = 1; i <= NF; i++)
|
||||||
if ($i !~ /[*?%]/)
|
if ($i !~ /[*?%]/)
|
||||||
print $i
|
print $i
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user