MCPcopy Index your code
hub / github.com/coder/mux / parseHostAndUser

Function parseHostAndUser

src/node/runtime/sshConfigParser.ts:61–73  ·  view source on GitHub ↗
(host: string)

Source from the content-addressed store, hash-verified

59}
60
61function parseHostAndUser(host: string): { host: string; user?: string } {
62 const trimmed = host.trim();
63 const atIndex = trimmed.lastIndexOf("@");
64 if (atIndex > 0) {
65 const user = trimmed.slice(0, atIndex).trim();
66 const hostname = trimmed.slice(atIndex + 1).trim();
67 if (user && hostname) {
68 return { host: hostname, user };
69 }
70 }
71
72 return { host: trimmed };
73}
74
75function isParsedValueToken(value: unknown): value is ParsedValueToken {
76 return typeof value === "object" && value !== null && "val" in value && "separator" in value;

Callers 1

resolveSSHConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected