@@ -17,6 +17,7 @@ func CreateUserCommand() *cobra.Command {
1717 Short : "Bugout user operations" ,
1818 }
1919
20+ userAuthCmd := CreateUserAuthCommand ()
2021 userCreateCmd := CreateUserCreateCommand ()
2122 userLoginCmd := CreateUserLoginCommand ()
2223 userTokensCmd := CreateUserTokensCommand ()
@@ -25,11 +26,38 @@ func CreateUserCommand() *cobra.Command {
2526 userVerifyCmd := CreateUserVerifyCommand ()
2627 userChangePasswordCmd := CreateUserChangePasswordCommand ()
2728
28- userCmd .AddCommand (userCreateCmd , userLoginCmd , userTokensCmd , userGetCmd , userFindCmd , userVerifyCmd , userChangePasswordCmd )
29+ userCmd .AddCommand (userAuthCmd , userCreateCmd , userLoginCmd , userTokensCmd , userGetCmd , userFindCmd , userVerifyCmd , userChangePasswordCmd )
2930
3031 return userCmd
3132}
3233
34+ func CreateUserAuthCommand () * cobra.Command {
35+ var token string
36+ userGetCmd := & cobra.Command {
37+ Use : "auth" ,
38+ Short : "Get the user with groups represented by a token" ,
39+ PreRunE : cmdutils .TokenArgPopulator ,
40+ RunE : func (cmd * cobra.Command , args []string ) error {
41+ client , err := bugout .ClientFromEnv ()
42+ if err != nil {
43+ return err
44+ }
45+
46+ userAuth , err := client .Brood .Auth (token )
47+ if err != nil {
48+ return err
49+ }
50+
51+ encodeErr := json .NewEncoder (cmd .OutOrStdout ()).Encode (& userAuth )
52+ return encodeErr
53+ },
54+ }
55+
56+ userGetCmd .Flags ().StringVarP (& token , "token" , "t" , "" , "Bugout access token to use for the request" )
57+
58+ return userGetCmd
59+ }
60+
3361func CreateUserCreateCommand () * cobra.Command {
3462 var username , email , password string
3563 userCreateCmd := & cobra.Command {
0 commit comments