Skip to content

Commit 96a2e12

Browse files
committed
document the codespaceSSHConfig struct
1 parent ca3b59d commit 96a2e12

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

pkg/cmd/codespace/ssh.go

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,22 @@ func (a *App) ListOpensshConfig(ctx context.Context, opts configOptions) error {
238238
return nil
239239
}
240240

241+
// codespaceSSHConfig contains values needed to write an openssh host
242+
// configuration for a single codespace. For example:
243+
//
244+
// Host {{Name}}.{{EscapedRef}
245+
// User {{SSHUser}
246+
// ProxyCommand {{GHExec}} cs ssh -c {{Name}} --stdio
247+
//
248+
// EscapedRef is included in the name to help distinguish between codespaces
249+
// when tab-completing ssh hostnames. '/' characters in EscapedRef are
250+
// flattened to '-' to prevent problems with tab completion or when the
251+
// hostname appears in ControlMaster socket paths.
241252
type codespaceSSHConfig struct {
242-
Name string
243-
EscapedRef string
244-
SSHUser string
245-
GHExec string
253+
Name string // the codespace name, passed to `ssh -c`
254+
EscapedRef string // the currently checked-out branch
255+
SSHUser string // the remote ssh username
256+
GHExec string // path used for invoking the current `gh` binary
246257
}
247258

248259
func openSSHSession(ctx context.Context, a *App, csName string, liveshareLogger *log.Logger) (*liveshare.Session, error) {

0 commit comments

Comments
 (0)