From 2550804d93ae08c1560144cb2e0ba995fb347704 Mon Sep 17 00:00:00 2001 From: Matti R Date: Mon, 2 Mar 2020 14:07:37 -0500 Subject: [PATCH] return clear error --- cmd/writefreely/user.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/writefreely/user.go b/cmd/writefreely/user.go index f6bdd84..58ecbfb 100644 --- a/cmd/writefreely/user.go +++ b/cmd/writefreely/user.go @@ -11,6 +11,8 @@ package main import ( + "fmt" + "github.com/writeas/writefreely" "github.com/urfave/cli/v2" @@ -61,6 +63,8 @@ func addUserAction(c *cli.Context) error { credentials := "" if c.NArg() > 0 { credentials = c.Args().Get(0) + } else { + return fmt.Errorf("No user passed. Example: writefreely user add [USER]:[PASSWORD]") } username, password, err := parseCredentials(credentials) if err != nil { @@ -74,6 +78,8 @@ func delUserAction(c *cli.Context) error { username := "" if c.NArg() > 0 { username = c.Args().Get(0) + } else { + return fmt.Errorf("No user passed. Example: writefreely user delete [USER]") } app := writefreely.NewApp(c.String("c")) return writefreely.DoDeleteAccount(app, username) @@ -83,6 +89,8 @@ func resetPassAction(c *cli.Context) error { username := "" if c.NArg() > 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")) return writefreely.ResetPassword(app, username)