summary refs log tree commit diff stats
path: root/koch.nim
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2021-05-17 01:28:52 -0700
committerGitHub <noreply@github.com>2021-05-17 01:28:52 -0700
commit8be5344b3bb74d62cff5aa6a18f4223680612ad5 (patch)
tree1974423851e0c32c04124439e7fea47ae2c60ff7 /koch.nim
parente904c6d87ccbb453f6f1d649b2c715bd3cebc815 (diff)
downloadNim-8be5344b3bb74d62cff5aa6a18f4223680612ad5.tar.gz
./koch --nonexistant now fails (#18036)
Diffstat (limited to 'koch.nim')
-rw-r--r--koch.nim9
1 files changed, 5 insertions, 4 deletions
diff --git a/koch.nim b/koch.nim
index 15355ec36..3d7276aee 100644
--- a/koch.nim
+++ b/koch.nim
@@ -634,9 +634,9 @@ proc valgrind(cmd: string) =
   let supp = getAppDir() / "tools" / "nimgrind.supp"
   exec("valgrind --suppressions=" & supp & valcmd)
 
-proc showHelp() =
+proc showHelp(success: bool) =
   quit(HelpText % [VersionAsString & spaces(44-len(VersionAsString)),
-                   CompileDate, CompileTime], QuitSuccess)
+                   CompileDate, CompileTime], if success: QuitSuccess else: QuitFailure)
 
 proc branchDone() =
   let thisBranch = execProcess("git symbolic-ref --short HEAD").strip()
@@ -656,6 +656,7 @@ when isMainModule:
     case op.kind
     of cmdLongOption, cmdShortOption:
       case normalize(op.key)
+      of "help", "h": showHelp(success = true)
       of "latest": latest = true
       of "stable": latest = false
       of "nim": nimExe = op.val.absolutePath # absolute so still works with changeDir
@@ -663,7 +664,7 @@ when isMainModule:
         localDocsOnly = true
         if op.val.len > 0:
           localDocsOut = op.val.absolutePath
-      else: showHelp()
+      else: showHelp(success = false)
     of cmdArgument:
       case normalize(op.key)
       of "boot": boot(op.cmdLineRest)
@@ -705,6 +706,6 @@ when isMainModule:
         exec("nimble install -y fusion@$#" % suffix)
       of "ic": icTest(op.cmdLineRest)
       of "branchdone": branchDone()
-      else: showHelp()
+      else: showHelp(success = false)
       break
     of cmdEnd: break