File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed
Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ package autostop
2+
3+ import (
4+ "github.com/spf13/cobra"
5+
6+ "github.com/brevdev/brev-cli/pkg/entity"
7+ breverrors "github.com/brevdev/brev-cli/pkg/errors"
8+ "github.com/brevdev/brev-cli/pkg/terminal"
9+ )
10+
11+ var (
12+ short = "TODO"
13+ long = "TODO"
14+ example = "TODO"
15+ )
16+
17+ func NewCmdautostop (t * terminal.Terminal , store autostopStore ) * cobra.Command {
18+ cmd := & cobra.Command {
19+ Use : "autostop" ,
20+ DisableFlagsInUseLine : true ,
21+ Short : short ,
22+ Long : long ,
23+ Example : example ,
24+ RunE : func (cmd * cobra.Command , args []string ) error {
25+ err := Runautostop (
26+ runAutostopArgs {
27+ t : t ,
28+ args : args ,
29+ store : store ,
30+ },
31+ )
32+ if err != nil {
33+ return breverrors .WrapAndTrace (err )
34+ }
35+ return nil
36+ },
37+ }
38+ return cmd
39+ }
40+
41+ type autostopStore interface {
42+ AutoStopWorkspace (workspaceID string ) (* entity.Workspace , error )
43+ }
44+
45+ type runAutostopArgs struct {
46+ t * terminal.Terminal
47+ args []string
48+ store autostopStore
49+ }
50+
51+ func Runautostop (args runAutostopArgs ) error {
52+ _ , err := args .store .AutoStopWorkspace (args .args [0 ])
53+ return breverrors .WrapAndTrace (err )
54+ }
You can’t perform that action at this time.
0 commit comments