aboutsummaryrefslogtreecommitdiffstats
path: root/commands/root.go
diff options
context:
space:
mode:
authorMichael Muré <michael.mure@consensys.net>2019-03-27 21:54:58 +0100
committerMichael Muré <michael.mure@consensys.net>2019-03-27 21:54:58 +0100
commitbdf8523dc0d8cbd9f29e62fa8605b5bd5292828e (patch)
treec2e1d3f0ecce614389c613e91fa7534225e8215e /commands/root.go
parentffc6cbdc45d379df231d8bc084e86f554015d5d9 (diff)
downloadgit-bug-bdf8523dc0d8cbd9f29e62fa8605b5bd5292828e.tar.gz
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
Diffstat (limited to 'commands/root.go')
-rw-r--r--commands/root.go4
1 files changed, 3 insertions, 1 deletions
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