add noSolve mode

This commit is contained in:
Daylin Morgan 2024-12-02 17:20:23 -06:00
parent 6f5d482865
commit 2d16655c21
Signed by: daylin
GPG key ID: 950D13E9719334AD
2 changed files with 6 additions and 2 deletions

View file

@ -1,4 +1,4 @@
import std/[algorithm, os, sequtils]
import std/[algorithm, os, strformat, sequtils]
--noNimblePath
--path:"./src"
@ -6,4 +6,7 @@ import std/[algorithm, os, sequtils]
task solve, "run all solutions":
for dir in walkDirRec("solutions", yieldFilter = {pcDir}).toSeq().sortedByIt(it):
echo "--",dir,"--"
selfExec "r --hint:all:off " & dir & "/solution.nim"
var cmd = "r --hint:all:off "
when defined(noSolve): cmd &= "-d:noSolve"
cmd &= fmt" {dir}/solution.nim "
selfExec cmd

View file

@ -6,6 +6,7 @@ import std/[
macro solve*(arg: untyped): untyped =
arg.expectKind nnkStmtList
result = newStmtList()
when defined(noSolve): return
for stmt in arg:
stmt.expectKind nnkCall
stmt[0].expectKind nnkStrLit