Skip to content

Commit b64817d

Browse files
authored
Merge pull request #292 from dgageot/fix-291
Don't print usage help when a config file couldn't be parsed
2 parents 718998d + 4ca576d commit b64817d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

cmd/root/root.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,10 @@ We collect anonymous usage data to help improve cagent. To disable:
143143
fmt.Fprintln(os.Stderr, "\nEither:\n - Set those environment variables before running cagent\n - Run cagent with --env-from-file\n - Store those secrets using one of the built-in environment variable providers.")
144144
} else {
145145
fmt.Fprintln(os.Stderr, err)
146-
_ = rootCmd.Usage()
146+
fmt.Fprintln(os.Stderr)
147+
if strings.HasPrefix(err.Error(), "unknown command ") || strings.HasPrefix(err.Error(), "accepts ") {
148+
_ = rootCmd.Usage()
149+
}
147150
}
148151

149152
os.Exit(1)

0 commit comments

Comments
 (0)