From 2e988bf59e54de686887e7e0d5e7f63f284f621c Mon Sep 17 00:00:00 2001 From: George Lemon Date: Sat, 10 Dec 2022 03:46:43 +0200 Subject: [PATCH] new `dumpProject` | Fix `author` field | `method` to `proc` Signed-off-by: George Lemon --- src/pkginfo.nim | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/pkginfo.nim b/src/pkginfo.nim index bb62001..3a29112 100644 --- a/src/pkginfo.nim +++ b/src/pkginfo.nim @@ -161,6 +161,8 @@ macro getPackageInformation(path: static string) = Package.name = v.getStr elif k == "version": Package.version = v.getStr + elif k == "author": + Package.author = v.getStr elif k == "desc": Package.desc = v.getStr elif k == "license": @@ -228,6 +230,21 @@ proc nimVersion*(): Version {.compileTime.} = ## Get Nim version from main working project result = parseVersion(Package.nim) +proc dumpProject*(): Pkg {.compileTime.} = + result = Pkg(pkgType: Main) + let localNimble = parseJson(staticExec("nimble dump " & getProjectPath() & "/.." & " --json" )) + for k, v in pairs(localNimble): + if k == "name": + result.name = v.getStr + elif k == "author": + result.author = v.getStr + elif k == "version": + result.version = v.getStr + elif k == "desc": + result.desc = v.getStr + elif k == "license": + result.license = v.getStr + macro pkg*(pkgName: static string = ""): untyped = result = newStmtList() if pkgName.len == 0: