summary refs log tree commit diff stats
path: root/tests/manyloc/nake/nake.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manyloc/nake/nake.nim')
-rw-r--r--tests/manyloc/nake/nake.nim19
1 files changed, 10 insertions, 9 deletions
diff --git a/tests/manyloc/nake/nake.nim b/tests/manyloc/nake/nake.nim
index 1e88fa73b..5d3173a20 100644
--- a/tests/manyloc/nake/nake.nim
+++ b/tests/manyloc/nake/nake.nim
@@ -22,10 +22,10 @@ proc runTask*(name: string) {.inline.}
 proc shell*(cmd: varargs[string, `$`]): int {.discardable.}
 proc cd*(dir: string) {.inline.}
 
-template nakeImports*(): stmt {.immediate.} =
+template nakeImports*() =
   import tables, parseopt, strutils, os
 
-template task*(name: string; description: string; body: stmt): stmt {.dirty, immediate.} =
+template task*(name: string; description: string; body: untyped) {.dirty.} =
   block:
     var t = newTask(description, proc() {.closure.} =
       body)
@@ -40,7 +40,7 @@ proc runTask*(name: string) = tasks[name].action()
 proc shell*(cmd: varargs[string, `$`]): int =
   result = execShellCmd(cmd.join(" "))
 proc cd*(dir: string) = setCurrentDir(dir)
-template withDir*(dir: string; body: stmt): stmt =
+template withDir*(dir: string; body: untyped) =
   ## temporary cd
   ## withDir "foo":
   ##   # inside foo
@@ -50,8 +50,8 @@ template withDir*(dir: string; body: stmt): stmt =
   body
   cd(curDir)
 
-when isMainModule:
-  if not existsFile("nakefile.nim"):
+when true:
+  if not fileExists("nakefile.nim"):
     echo "No nakefile.nim found. Current working dir is ", getCurrentDir()
     quit 1
   var args = ""
@@ -60,14 +60,15 @@ when isMainModule:
     args.add " "
   quit(shell("nim", "c", "-r", "nakefile.nim", args))
 else:
-  addQuitProc(proc() {.noconv.} =
+  import std/exitprocs
+  addExitProc(proc() {.noconv.} =
     var
       task: string
       printTaskList: bool
-    for kind, key, val in getOpt():
+    for kind, key, val in getopt():
       case kind
       of cmdLongOption, cmdShortOption:
-        case key.tolower
+        case key.tolowerAscii
         of "tasks", "t":
           printTaskList = true
         else:
@@ -75,7 +76,7 @@ else:
       of cmdArgument:
         task = key
       else: discard
-    if printTaskList or task.isNil or not(tasks.hasKey(task)):
+    if printTaskList or task.len == 0 or not(tasks.hasKey(task)):
       echo "Available tasks:"
       for name, task in pairs(tasks):
         echo name, " - ", task.desc