Skip to content

Commit

Permalink
new dumpProject | Fix author field | method to proc
Browse files Browse the repository at this point in the history
Signed-off-by: George Lemon <[email protected]>
  • Loading branch information
georgelemon committed Dec 10, 2022
1 parent 1942a57 commit 2e988bf
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/pkginfo.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 2e988bf

Please sign in to comment.