Skip to content

Commit 7b2ff84

Browse files
committed
add as debug cmd, filter for user envs and add as debug cmd
1 parent c12be26 commit 7b2ff84

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

.vscode/launch.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,5 +248,18 @@
248248
"brev-cli",
249249
],
250250
},
251+
{
252+
"name": "autostop",
253+
"type": "go",
254+
"request": "launch",
255+
"mode": "auto",
256+
"program": "${workspaceFolder}/main.go",
257+
// "envFile": "${workspaceFolder}/prod_lite.env",
258+
// "envFile": "${workspaceFolder}/local.env",
259+
"args": [
260+
"autostop",
261+
"brev-cli",
262+
],
263+
},
251264
]
252265
}

pkg/cmd/cmd.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66

77
"github.com/brevdev/brev-cli/pkg/auth"
88
"github.com/brevdev/brev-cli/pkg/cmd/approve"
9+
"github.com/brevdev/brev-cli/pkg/cmd/autostop"
910
"github.com/brevdev/brev-cli/pkg/cmd/bmon"
1011
"github.com/brevdev/brev-cli/pkg/cmd/clipboard"
1112
"github.com/brevdev/brev-cli/pkg/cmd/configureenvvars"
@@ -276,6 +277,7 @@ func createCmdTree(cmd *cobra.Command, t *terminal.Terminal, loginCmdStore *stor
276277
cmd.AddCommand(bmon.NewCmdbmon(t, loginCmdStore))
277278
cmd.AddCommand(upgrade.NewCmdUpgrade(t, loginCmdStore))
278279
cmd.AddCommand(writeconnectionevent.NewCmdwriteConnectionEvent(t, loginCmdStore))
280+
cmd.AddCommand(autostop.NewCmdautostop(t, loginCmdStore))
279281
}
280282

281283
func hasHousekeepingCommands(cmd *cobra.Command) bool {

pkg/store/workspace.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,12 @@ func (s AuthHTTPStore) GetWorkspaceByNameOrID(orgID string, nameOrID string) ([]
208208
if err != nil {
209209
return nil, breverrors.WrapAndTrace(err)
210210
}
211+
// pretty srue we always want to do this
212+
user, err := s.GetCurrentUser()
213+
if err != nil {
214+
return nil, breverrors.WrapAndTrace(err)
215+
}
216+
workspaces = FilterForUserWorkspaces(workspaces, user.ID)
211217
return workspaces, nil
212218
}
213219

0 commit comments

Comments
 (0)