MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / NormalizeConfigPattern

Function NormalizeConfigPattern

pkg/remote/connutil.go:169–191  ·  view source on GitHub ↗
(pattern string)

Source from the content-addressed store, hash-verified

167}
168
169func NormalizeConfigPattern(pattern string) string {
170 userName, err := WaveSshConfigUserSettings().GetStrict(pattern, "User")
171 if err != nil || userName == "" {
172 log.Printf("warning: error parsing username of %s for conn dropdown: %v", pattern, err)
173 localUser, err := user.Current()
174 if err == nil {
175 userName = localUser.Username
176 }
177 }
178 port, err := WaveSshConfigUserSettings().GetStrict(pattern, "Port")
179 if err != nil {
180 port = "22"
181 }
182 if userName != "" {
183 userName += "@"
184 }
185 if port == "22" {
186 port = ""
187 } else {
188 port = ":" + port
189 }
190 return fmt.Sprintf("%s%s%s", userName, pattern, port)
191}
192
193func ParseProfiles() []string {
194 connfile, cerrs := wconfig.ReadWaveHomeConfigFile(wconfig.ProfilesFile)

Callers 1

resolveSshConfigPatternsFunction · 0.92

Calls 1

Tested by

no test coverage detected