Skip to content

Commit 268c187

Browse files
committed
fixup
1 parent 2917474 commit 268c187

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

enterprise/cli/groupcreate.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ func (r *RootCmd) groupCreate() *serpent.Command {
1616
var (
1717
avatarURL string
1818
displayName string
19+
orgContext = agpl.NewOrganizationContext()
1920
)
2021

2122
client := new(codersdk.Client)
@@ -29,7 +30,7 @@ func (r *RootCmd) groupCreate() *serpent.Command {
2930
Handler: func(inv *serpent.Invocation) error {
3031
ctx := inv.Context()
3132

32-
org, err := agpl.CurrentOrganization(&r.RootCmd, inv, client)
33+
org, err := orgContext.Selected(inv, client)
3334
if err != nil {
3435
return xerrors.Errorf("current organization: %w", err)
3536
}
@@ -63,6 +64,7 @@ func (r *RootCmd) groupCreate() *serpent.Command {
6364
Value: serpent.StringOf(&displayName),
6465
},
6566
}
67+
orgContext.AttachOptions(cmd)
6668

6769
return cmd
6870
}

enterprise/cli/groupdelete.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
)
1414

1515
func (r *RootCmd) groupDelete() *serpent.Command {
16+
orgContext := agpl.NewOrganizationContext()
1617
client := new(codersdk.Client)
1718
cmd := &serpent.Command{
1819
Use: "delete <name>",
@@ -27,7 +28,7 @@ func (r *RootCmd) groupDelete() *serpent.Command {
2728
groupName = inv.Args[0]
2829
)
2930

30-
org, err := agpl.CurrentOrganization(&r.RootCmd, inv, client)
31+
org, err := orgContext.Selected(inv, client)
3132
if err != nil {
3233
return xerrors.Errorf("current organization: %w", err)
3334
}
@@ -46,6 +47,7 @@ func (r *RootCmd) groupDelete() *serpent.Command {
4647
return nil
4748
},
4849
}
50+
orgContext.AttachOptions(cmd)
4951

5052
return cmd
5153
}

enterprise/cli/groupedit.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ func (r *RootCmd) groupEdit() *serpent.Command {
2222
displayName string
2323
addUsers []string
2424
rmUsers []string
25+
orgContext = agpl.NewOrganizationContext()
2526
)
2627
client := new(codersdk.Client)
2728
cmd := &serpent.Command{
@@ -37,7 +38,7 @@ func (r *RootCmd) groupEdit() *serpent.Command {
3738
groupName = inv.Args[0]
3839
)
3940

40-
org, err := agpl.CurrentOrganization(&r.RootCmd, inv, client)
41+
org, err := orgContext.Selected(inv, client)
4142
if err != nil {
4243
return xerrors.Errorf("current organization: %w", err)
4344
}
@@ -116,6 +117,7 @@ func (r *RootCmd) groupEdit() *serpent.Command {
116117
Value: serpent.StringArrayOf(&rmUsers),
117118
},
118119
}
120+
orgContext.AttachOptions(cmd)
119121

120122
return cmd
121123
}

enterprise/cli/grouplist.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ func (r *RootCmd) groupList() *serpent.Command {
1818
cliui.TableFormat([]groupTableRow{}, nil),
1919
cliui.JSONFormat(),
2020
)
21+
orgContext := agpl.NewOrganizationContext()
2122

2223
client := new(codersdk.Client)
2324
cmd := &serpent.Command{
@@ -30,7 +31,7 @@ func (r *RootCmd) groupList() *serpent.Command {
3031
Handler: func(inv *serpent.Invocation) error {
3132
ctx := inv.Context()
3233

33-
org, err := agpl.CurrentOrganization(&r.RootCmd, inv, client)
34+
org, err := orgContext.Selected(inv, client)
3435
if err != nil {
3536
return xerrors.Errorf("current organization: %w", err)
3637
}
@@ -58,6 +59,7 @@ func (r *RootCmd) groupList() *serpent.Command {
5859
}
5960

6061
formatter.AttachOptions(&cmd.Options)
62+
orgContext.AttachOptions(cmd)
6163
return cmd
6264
}
6365

0 commit comments

Comments
 (0)