From bdf8523dc0d8cbd9f29e62fa8605b5bd5292828e Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Wed, 27 Mar 2019 21:54:58 +0100 Subject: commands: only return the error (not the function help) when no identity is set ... to avoid misleading a user into thinking the usage was incorrect --- commands/root.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'commands') diff --git a/commands/root.go b/commands/root.go index adbf51d9..3438d15c 100644 --- a/commands/root.go +++ b/commands/root.go @@ -88,7 +88,9 @@ func loadRepoEnsureUser(cmd *cobra.Command, args []string) error { } if !set { - return identity.ErrNoIdentitySet + // Print the error directly to not confuse a user + _, _ = fmt.Fprintln(os.Stderr, identity.ErrNoIdentitySet.Error()) + os.Exit(-1) } return nil -- cgit