Let Cobra do the usage error logging

Fixes #1472
This commit is contained in:
Bjørn Erik Pedersen 2015-10-05 20:26:49 +02:00
parent b9aaa0079b
commit b25ba8b095
3 changed files with 5 additions and 44 deletions

View file

@ -67,7 +67,10 @@ var Source, CacheDir, Destination, Theme, BaseURL, CfgFile, LogFile, Editor stri
func Execute() {
HugoCmd.SetGlobalNormalizationFunc(helpers.NormalizeHugoFlags)
AddCommands()
utils.StopOnErr(HugoCmd.Execute())
if err := HugoCmd.Execute(); err != nil {
// the err is already logged by Cobra
os.Exit(-1)
}
}
//AddCommands adds child commands to the root command HugoCmd.