MCPcopy Index your code
hub / github.com/coder/coder / ssh

Method ssh

cli/ssh.go:116–887  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

114}
115
116func (r *RootCmd) ssh() *serpent.Command {
117 var (
118 stdio bool
119 tty bool
120 hostPrefix string
121 hostnameSuffix string
122 forceNewTunnel bool
123 forwardAgent bool
124 forwardGPG bool
125 identityAgent string
126 wsPollInterval time.Duration
127 waitEnum string
128 noWait bool
129 logDirPath string
130 remoteForwards []string
131 env []string
132 usageApp string
133 disableAutostart bool
134 networkInfoDir string
135 networkInfoInterval time.Duration
136
137 containerName string
138 containerUser string
139 )
140 cmd := &serpent.Command{
141 Annotations: workspaceCommand,
142 Use: "ssh <workspace> [command]",
143 Short: "Start a shell into a workspace or run a command",
144 Long: "This command does not have full parity with the standard SSH command. For users who need the full functionality of SSH, create an ssh configuration with `coder config-ssh`.\n\n" +
145 FormatExamples(
146 Example{
147 Description: "Use `--` to separate and pass flags directly to the command executed via SSH.",
148 Command: "coder ssh <workspace> -- ls -la",
149 },
150 ),
151 Middleware: serpent.Chain(
152 // Require at least one arg for the workspace name
153 func(next serpent.HandlerFunc) serpent.HandlerFunc {
154 return func(i *serpent.Invocation) error {
155 got := len(i.Args)
156 if got < 1 {
157 return xerrors.New("expected the name of a workspace")
158 }
159
160 return next(i)
161 }
162 },
163 ),
164 CompletionHandler: func(inv *serpent.Invocation) []string {
165 client, err := r.InitClient(inv)
166 if err != nil {
167 return []string{}
168 }
169
170 res, err := client.Workspaces(inv.Context(), codersdk.WorkspaceFilter{
171 Owner: codersdk.Me,
172 })
173 if err != nil {

Callers 1

CoreSubcommandsMethod · 0.95

Calls 15

InitClientMethod · 0.95
CloseMethod · 0.95
AwaitReachableMethod · 0.95
SSHMethod · 0.95
SSHClientMethod · 0.95
TailnetConnMethod · 0.95
NewFunction · 0.92
StringCharsetFunction · 0.92
DiscardAfterCloseFunction · 0.92
AgentFunction · 0.92
ExistsViaCoderConnectFunction · 0.92
InfoFunction · 0.92

Tested by

no test coverage detected