Fix command line args setup (#120)

- commandLineParams is the correct way to access args
This commit is contained in:
Ivan Yonchovski 2022-06-23 00:37:05 +03:00 committed by GitHub
parent cf4a0a393e
commit 1088e43c2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -37,8 +37,14 @@ proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
mkDir "build"
# allow something like "nim nimbus --verbosity:0 --hints:off nimbus.nims"
var extra_params = params
when compiles(commandLineParams):
for param in commandLineParams:
extra_params &= " " & param
else:
for i in 2..<paramCount():
extra_params &= " " & paramStr(i)
exec "nim " & lang & " --out:build/" & name & " " & extra_params & " " & srcDir & name & ".nim"
proc test(name: string, srcDir = "tests/", lang = "c") =