fix(cli): rename user project command
continuous-integration/drone/push Build is failing Details

This commit is contained in:
kolaente 2023-05-10 22:37:37 +02:00
parent cade124799
commit 7d9e8bd150
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 8 additions and 8 deletions

View File

@ -73,7 +73,7 @@ func init() {
// User deletion flags
userDeleteCmd.Flags().BoolVarP(&userFlagDeleteNow, "now", "n", false, "If provided, deletes the user immediately instead of sending them an email first.")
userCmd.AddCommand(userProjectCmd, userCreateCmd, userUpdateCmd, userResetPasswordCmd, userChangeEnabledCmd, userDeleteCmd)
userCmd.AddCommand(userListCmd, userCreateCmd, userUpdateCmd, userResetPasswordCmd, userChangeEnabledCmd, userDeleteCmd)
rootCmd.AddCommand(userCmd)
}
@ -117,9 +117,9 @@ var userCmd = &cobra.Command{
Short: "Manage users locally through the cli.",
}
var userProjectCmd = &cobra.Command{
Use: "project",
Short: "Shows a project of all users.",
var userListCmd = &cobra.Command{
Use: "list",
Short: "Shows a list of all users.",
PreRun: func(cmd *cobra.Command, args []string) {
initialize.FullInit()
},
@ -127,7 +127,7 @@ var userProjectCmd = &cobra.Command{
s := db.NewSession()
defer s.Close()
users, err := user.ProjectAllUsers(s)
users, err := user.ListAllUsers(s)
if err != nil {
_ = s.Rollback()
log.Fatalf("Error getting users: %s", err)

View File

@ -397,7 +397,7 @@ func TestProjectUsers(t *testing.T) {
s := db.NewSession()
defer s.Close()
all, err := ProjectAllUsers(s)
all, err := ListAllUsers(s)
assert.NoError(t, err)
assert.Len(t, all, 15)
})

View File

@ -106,8 +106,8 @@ outer:
return
}
// ProjectAllUsers returns all users
func ProjectAllUsers(s *xorm.Session) (users []*User, err error) {
// ListAllUsers returns all users
func ListAllUsers(s *xorm.Session) (users []*User, err error) {
err = s.Find(&users)
return
}