File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ func (r *RootCmd) userList() *serpent.Command {
19
19
cliui .JSONFormat (),
20
20
)
21
21
client := new (codersdk.Client )
22
+ var githubUserID int64
22
23
23
24
cmd := & serpent.Command {
24
25
Use : "list" ,
@@ -27,8 +28,23 @@ func (r *RootCmd) userList() *serpent.Command {
27
28
serpent .RequireNArgs (0 ),
28
29
r .InitClient (client ),
29
30
),
31
+ Options : serpent.OptionSet {
32
+ {
33
+ Name : "github-user-id" ,
34
+ Description : "Filter users by their GitHub user ID." ,
35
+ Default : "" ,
36
+ Flag : "github-user-id" ,
37
+ Required : false ,
38
+ Value : serpent .Int64Of (& githubUserID ),
39
+ },
40
+ },
30
41
Handler : func (inv * serpent.Invocation ) error {
31
- res , err := client .Users (inv .Context (), codersdk.UsersRequest {})
42
+ req := codersdk.UsersRequest {}
43
+ if githubUserID != 0 {
44
+ req .Search = fmt .Sprintf ("github_com_user_id:%d" , githubUserID )
45
+ }
46
+
47
+ res , err := client .Users (inv .Context (), req )
32
48
if err != nil {
33
49
return err
34
50
}
You can’t perform that action at this time.
0 commit comments