aboutsummaryrefslogtreecommitdiffhomepage
path: root/commands
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2022-01-06 10:22:19 +0100
committerBjørn Erik Pedersen <[email protected]>2022-01-06 12:27:04 +0100
commitc8b5ab75b743914f89b51046eee8e3daa2eb1eec (patch)
treef37e135fd0ed109f091676b9885c71e5ddf4e2cb /commands
parent85c5b895939031334e2b9caa598cdee45e14dd5b (diff)
downloadhugo-c8b5ab75b743914f89b51046eee8e3daa2eb1eec.tar.gz
hugo-c8b5ab75b743914f89b51046eee8e3daa2eb1eec.zip
Add --panicOnWarning flag
Fixes #9357 Fixes #9359
Diffstat (limited to 'commands')
-rw-r--r--commands/commands.go2
-rw-r--r--commands/helpers.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/commands/commands.go b/commands/commands.go
index b6e8dd469..7a9f9fc9e 100644
--- a/commands/commands.go
+++ b/commands/commands.go
@@ -299,7 +299,7 @@ func (cc *hugoBuilderCommon) handleFlags(cmd *cobra.Command) {
cmd.Flags().Bool("enableGitInfo", false, "add Git revision, date and author info to the pages")
cmd.Flags().BoolVar(&cc.gc, "gc", false, "enable to run some cleanup tasks (remove unused cache files) after the build")
cmd.Flags().StringVar(&cc.poll, "poll", "", "set this to a poll interval, e.g --poll 700ms, to use a poll based approach to watch for file system changes")
-
+ cmd.Flags().BoolVar(&loggers.PanicOnWarning, "panicOnWarning", false, "panic on first WARNING log")
cmd.Flags().Bool("templateMetrics", false, "display metrics about template executions")
cmd.Flags().Bool("templateMetricsHints", false, "calculate some improvement hints when combined with --templateMetrics")
cmd.Flags().BoolP("forceSyncStatic", "", false, "copy all files when static is changed.")
diff --git a/commands/helpers.go b/commands/helpers.go
index 1386e425f..8bd7b18a3 100644
--- a/commands/helpers.go
+++ b/commands/helpers.go
@@ -68,7 +68,7 @@ func newSystemErrorF(format string, a ...interface{}) commandError {
// Catch some of the obvious user errors from Cobra.
// We don't want to show the usage message for every error.
// The below may be to generic. Time will show.
-var userErrorRegexp = regexp.MustCompile("argument|flag|shorthand")
+var userErrorRegexp = regexp.MustCompile("unknown flag")
func isUserError(err error) bool {
if cErr, ok := err.(commandError); ok && cErr.isUserError() {