mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
feat: restart stopped workspaces on ssh command (#11050)
* feat: autostart workspaces on ssh & port forward This is opt out by default. VScode ssh does not have this behavior
This commit is contained in:
@ -26,8 +26,9 @@ import (
|
||||
|
||||
func (r *RootCmd) portForward() *clibase.Cmd {
|
||||
var (
|
||||
tcpForwards []string // <port>:<port>
|
||||
udpForwards []string // <port>:<port>
|
||||
tcpForwards []string // <port>:<port>
|
||||
udpForwards []string // <port>:<port>
|
||||
disableAutostart bool
|
||||
)
|
||||
client := new(codersdk.Client)
|
||||
cmd := &clibase.Cmd{
|
||||
@ -76,7 +77,7 @@ func (r *RootCmd) portForward() *clibase.Cmd {
|
||||
return xerrors.New("no port-forwards requested")
|
||||
}
|
||||
|
||||
workspace, workspaceAgent, err := getWorkspaceAndAgent(ctx, inv, client, codersdk.Me, inv.Args[0])
|
||||
workspace, workspaceAgent, err := getWorkspaceAndAgent(ctx, inv, client, !disableAutostart, codersdk.Me, inv.Args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -180,6 +181,7 @@ func (r *RootCmd) portForward() *clibase.Cmd {
|
||||
Description: "Forward UDP port(s) from the workspace to the local machine. The UDP connection has TCP-like semantics to support stateful UDP protocols.",
|
||||
Value: clibase.StringArrayOf(&udpForwards),
|
||||
},
|
||||
sshDisableAutostartOption(clibase.BoolOf(&disableAutostart)),
|
||||
}
|
||||
|
||||
return cmd
|
||||
|
Reference in New Issue
Block a user