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

Method rptyCommand

cli/exp_rpty.go:24–75  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22)
23
24func (r *RootCmd) rptyCommand() *serpent.Command {
25 var args handleRPTYArgs
26
27 cmd := &serpent.Command{
28 Handler: func(inv *serpent.Invocation) error {
29 if r.disableDirect {
30 return xerrors.New("direct connections are disabled, but you can try websocat ;-)")
31 }
32 client, err := r.InitClient(inv)
33 if err != nil {
34 return err
35 }
36 args.NamedWorkspace = inv.Args[0]
37 args.Command = inv.Args[1:]
38 return handleRPTY(inv, client, args)
39 },
40 Long: "Establish an RPTY session with a workspace/agent. This uses the same mechanism as the Web Terminal.",
41 Middleware: serpent.Chain(
42 serpent.RequireRangeArgs(1, -1),
43 ),
44 Options: []serpent.Option{
45 {
46 Name: "container",
47 Description: "The container name or ID to connect to.",
48 Flag: "container",
49 FlagShorthand: "c",
50 Default: "",
51 Value: serpent.StringOf(&args.Container),
52 },
53 {
54 Name: "container-user",
55 Description: "The user to connect as.",
56 Flag: "container-user",
57 FlagShorthand: "u",
58 Default: "",
59 Value: serpent.StringOf(&args.ContainerUser),
60 },
61 {
62 Name: "reconnect",
63 Description: "The reconnect ID to use.",
64 Flag: "reconnect",
65 FlagShorthand: "r",
66 Default: "",
67 Value: serpent.StringOf(&args.ReconnectID),
68 },
69 },
70 Short: "Establish an RPTY session with a workspace/agent.",
71 Use: "rpty",
72 }
73
74 return cmd
75}
76
77type handleRPTYArgs struct {
78 Command []string

Callers 1

AGPLExperimentalMethod · 0.95

Calls 3

InitClientMethod · 0.95
handleRPTYFunction · 0.85
NewMethod · 0.65

Tested by

no test coverage detected