summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2018-06-25 15:46:38 +0200
committerLemonBoy <thatlemon@gmail.com>2018-06-25 15:46:38 +0200
commit589d6bc8d81408df88298dd6cd3ee176d4bdbc46 (patch)
tree1767d78e6ef8d2f4d7fac631480199d2a385283a
parent890086baec8c23d65db20893c9ec5b50cee92335 (diff)
downloadNim-589d6bc8d81408df88298dd6cd3ee176d4bdbc46.tar.gz
Warn the user if the specified verbosity level is wrong
-rw-r--r--compiler/commands.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/commands.nim b/compiler/commands.nim
index 330504a76..866405f9f 100644
--- a/compiler/commands.nim
+++ b/compiler/commands.nim
@@ -606,7 +606,10 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
     incl(conf.globalOptions, optRun)
   of "verbosity":
     expectArg(conf, switch, arg, pass, info)
-    conf.verbosity = parseInt(arg)
+    let verbosity = parseInt(arg)
+    if verbosity notin {0..3}:
+      localError(conf, info, "invalid verbosity level: '$1'" % arg)
+    conf.verbosity = verbosity
     conf.notes = NotesVerbosity[conf.verbosity]
     incl(conf.notes, conf.enableNotes)
     excl(conf.notes, conf.disableNotes)