simplify nimscript.nim
This commit is contained in:
parent
9659540b18
commit
a2bb7d4c71
3 changed files with 10 additions and 25 deletions
|
|
@ -144,28 +144,13 @@ template task*(name: untyped; description: string; body: untyped): untyped =
|
|||
proc `name Task`() = body
|
||||
|
||||
let cmd = getCommand()
|
||||
if cmd.len == 0 or cmd ==? "help" or cmd == "nop":
|
||||
setCommand "nop"
|
||||
if cmd.len == 0 or cmd ==? "help":
|
||||
setCommand "help"
|
||||
writeTask(astToStr(name), description)
|
||||
elif cmd ==? astToStr(name):
|
||||
setCommand "nop"
|
||||
`name Task`()
|
||||
|
||||
type
|
||||
VersionReq* = distinct string ## Describes a version requirement.
|
||||
|
||||
template v*(name: string{lit}): VersionReq = VersionReq(name)
|
||||
template special*(name: string): VersionReq = VersionReq(name)
|
||||
template `<`*(v: VersionReq): VersionReq = VersionReq("<" & string(v))
|
||||
template `<=`*(v: VersionReq): VersionReq = VersionReq("<=" & string(v))
|
||||
template `>`*(v: VersionReq): VersionReq = VersionReq(">" & string(v))
|
||||
template `>=`*(v: VersionReq): VersionReq = VersionReq(">=" & string(v))
|
||||
template `&`*(a, b: VersionReq): VersionReq =
|
||||
VersionReq(string(a) & " & " & string(b))
|
||||
|
||||
const
|
||||
anyVersion* = VersionReq("*")
|
||||
|
||||
var
|
||||
packageName* = ""
|
||||
version*, author*, description*, license*, srcdir*,
|
||||
|
|
@ -173,7 +158,7 @@ var
|
|||
|
||||
skipDirs*, skipFiles*, skipExt*, installDirs*, installFiles*,
|
||||
installExt*, bin*: seq[string]
|
||||
requiresData*: seq[(string, VersionReq)]
|
||||
requiresData*: seq[string]
|
||||
|
||||
proc requires*(name: string; v: VersionReq) =
|
||||
requiresData.add((name, v))
|
||||
proc requires*(deps: varargs[string]) =
|
||||
for d in deps: requiresData.add(d)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue