forked from pocketbase/pocketbase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed the error reporting of admin update/delete commands
- Loading branch information
1 parent
442b286
commit 722a749
Showing
2 changed files
with
9 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,12 +67,10 @@ func adminCreateCommand(app core.App) *cobra.Command { | |
|
||
func adminUpdateCommand(app core.App) *cobra.Command { | ||
command := &cobra.Command{ | ||
Use: "update", | ||
Example: "admin update [email protected] 1234567890", | ||
Short: "Changes the password of a single admin account", | ||
// prevents printing the error log twice | ||
SilenceErrors: true, | ||
SilenceUsage: true, | ||
Use: "update", | ||
Example: "admin update [email protected] 1234567890", | ||
Short: "Changes the password of a single admin account", | ||
SilenceUsage: true, | ||
RunE: func(command *cobra.Command, args []string) error { | ||
if len(args) != 2 { | ||
return errors.New("Missing email and password arguments.") | ||
|
@@ -111,12 +109,10 @@ func adminUpdateCommand(app core.App) *cobra.Command { | |
|
||
func adminDeleteCommand(app core.App) *cobra.Command { | ||
command := &cobra.Command{ | ||
Use: "delete", | ||
Example: "admin delete [email protected]", | ||
Short: "Deletes an existing admin account", | ||
// prevents printing the error log twice | ||
SilenceErrors: true, | ||
SilenceUsage: true, | ||
Use: "delete", | ||
Example: "admin delete [email protected]", | ||
Short: "Deletes an existing admin account", | ||
SilenceUsage: true, | ||
RunE: func(command *cobra.Command, args []string) error { | ||
if len(args) == 0 || args[0] == "" || is.EmailFormat.Validate(args[0]) != nil { | ||
return errors.New("Invalid or missing email address.") | ||
|