From 2d16655c21e2787f1dc99716f2920c4eff1b0e3b Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Mon, 2 Dec 2024 17:20:23 -0600 Subject: [PATCH] add noSolve mode --- config.nims | 7 +++++-- src/aoc.nim | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config.nims b/config.nims index 9f149aa..174ab5a 100644 --- a/config.nims +++ b/config.nims @@ -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 diff --git a/src/aoc.nim b/src/aoc.nim index fa10b8e..6452605 100644 --- a/src/aoc.nim +++ b/src/aoc.nim @@ -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