return clear error

pull/261/head
Matti R 5 years ago
parent b6044120ef
commit 2550804d93
No known key found for this signature in database
GPG Key ID: 9D8A57ADAA232E95
  1. 8
      cmd/writefreely/user.go

@ -11,6 +11,8 @@
package main package main
import ( import (
"fmt"
"github.com/writeas/writefreely" "github.com/writeas/writefreely"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
@ -61,6 +63,8 @@ func addUserAction(c *cli.Context) error {
credentials := "" credentials := ""
if c.NArg() > 0 { if c.NArg() > 0 {
credentials = c.Args().Get(0) credentials = c.Args().Get(0)
} else {
return fmt.Errorf("No user passed. Example: writefreely user add [USER]:[PASSWORD]")
} }
username, password, err := parseCredentials(credentials) username, password, err := parseCredentials(credentials)
if err != nil { if err != nil {
@ -74,6 +78,8 @@ func delUserAction(c *cli.Context) error {
username := "" username := ""
if c.NArg() > 0 { if c.NArg() > 0 {
username = c.Args().Get(0) username = c.Args().Get(0)
} else {
return fmt.Errorf("No user passed. Example: writefreely user delete [USER]")
} }
app := writefreely.NewApp(c.String("c")) app := writefreely.NewApp(c.String("c"))
return writefreely.DoDeleteAccount(app, username) return writefreely.DoDeleteAccount(app, username)
@ -83,6 +89,8 @@ func resetPassAction(c *cli.Context) error {
username := "" username := ""
if c.NArg() > 0 { if c.NArg() > 0 {
username = c.Args().Get(0) username = c.Args().Get(0)
} else {
return fmt.Errorf("No user passed. Example: writefreely user reset-pass [USER]")
} }
app := writefreely.NewApp(c.String("c")) app := writefreely.NewApp(c.String("c"))
return writefreely.ResetPassword(app, username) return writefreely.ResetPassword(app, username)

Loading…
Cancel
Save