MCPcopy
hub / github.com/wavetermdev/waveterm / ParseOpts

Function ParseOpts

pkg/remote/connutil.go:31–40  ·  view source on GitHub ↗
(input string)

Source from the content-addressed store, hash-verified

29var userHostRe = regexp.MustCompile(`^([a-zA-Z0-9][a-zA-Z0-9._@\\-]*@)?([a-zA-Z0-9][a-zA-Z0-9.-]*)(?::([0-9]+))?$`)
30
31func ParseOpts(input string) (*SSHOpts, error) {
32 m := userHostRe.FindStringSubmatch(input)
33 if m == nil {
34 return nil, fmt.Errorf("invalid format of user@host argument")
35 }
36 remoteUser, remoteHost, remotePort := m[1], m[2], m[3]
37 remoteUser = strings.Trim(remoteUser, "@")
38
39 return &SSHOpts{SSHHost: remoteHost, SSHUser: remoteUser, SSHPort: remotePort}, nil
40}
41
42func normalizeOs(os string) string {
43 os = strings.ToLower(strings.TrimSpace(os))

Callers 15

ConnDisconnectCommandMethod · 0.92
ConnConnectCommandMethod · 0.92
ConnUpdateWshCommandMethod · 0.92
DismissWshFailCommandMethod · 0.92
IsConnectedFunction · 0.92
EnsureConnectionFunction · 0.92
getConnUnionMethod · 0.92
CheckConnStatusFunction · 0.92
startNewJobMethod · 0.92
validateConnectionNameFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected