Skip to content

Commit 4f5b419

Browse files
hangxuanlonnywong
hangxuan
authored andcommitted
Resolve the actual Hostname if in the config Hostname is %h
1 parent f0e7ecc commit 4f5b419

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tssh/login.go

+7-5
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,13 @@ func getLoginParam(args *sshArgs) (*loginParam, error) {
115115
args.Destination = destHost
116116

117117
// login host
118-
hostName := getConfig(destHost, "HostName")
119-
if hostName != "" {
120-
param.host = hostName
121-
} else {
122-
param.host = destHost
118+
param.host = destHost
119+
if hostName := getConfig(destHost, "HostName"); hostName != "" {
120+
var err error
121+
param.host, err = expandTokens(hostName, args, param, "%h")
122+
if err != nil {
123+
return nil, err
124+
}
123125
}
124126

125127
// login user

0 commit comments

Comments
 (0)