|
|
@ -28,15 +28,13 @@ func extractHost(prog string, args []string) string { |
|
|
|
args = removeOptions(prog, args) |
|
|
|
switch prog { |
|
|
|
case "ssh": |
|
|
|
if len(args) == 0 { |
|
|
|
return "" |
|
|
|
} |
|
|
|
re := hostRegexps["ssh"] |
|
|
|
arg := args[0] |
|
|
|
p := matchParams(re, arg) |
|
|
|
return p["host"] |
|
|
|
case "scp": |
|
|
|
re := hostRegexps["scp"] |
|
|
|
args = args[0:2] |
|
|
|
for _, arg := range args { |
|
|
|
if p := matchParams(re, arg); p != nil { |
|
|
|
return p["host"] |
|
|
@ -53,9 +51,7 @@ func findIdentityName(config Config, prog string, args []string) string { |
|
|
|
} |
|
|
|
identities := config.Identities |
|
|
|
host := extractHost(prog, args) |
|
|
|
for _, identity := range identities { |
|
|
|
match := identity.Key.(string) |
|
|
|
name := identity.Value.(string) |
|
|
|
for match, name := range identities { |
|
|
|
if strings.Contains(host, match) { |
|
|
|
return name |
|
|
|
} |
|
|
|