fix(cli): rename user project command
This commit is contained in:
parent
cade124799
commit
7d9e8bd150
@ -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)
|
||||
|
@ -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)
|
||||
})
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user