simplify nimscript.nim
This commit is contained in:
parent
9659540b18
commit
a2bb7d4c71
3 changed files with 10 additions and 25 deletions
|
|
@ -355,7 +355,7 @@ proc mainCommand* =
|
||||||
gGlobalOptions.incl(optCaasEnabled)
|
gGlobalOptions.incl(optCaasEnabled)
|
||||||
msgs.gErrorMax = high(int) # do not stop after first error
|
msgs.gErrorMax = high(int) # do not stop after first error
|
||||||
serve(mainCommand)
|
serve(mainCommand)
|
||||||
of "nop": discard
|
of "nop", "help": discard
|
||||||
else:
|
else:
|
||||||
rawMessage(errInvalidCommandX, command)
|
rawMessage(errInvalidCommandX, command)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,28 +144,13 @@ template task*(name: untyped; description: string; body: untyped): untyped =
|
||||||
proc `name Task`() = body
|
proc `name Task`() = body
|
||||||
|
|
||||||
let cmd = getCommand()
|
let cmd = getCommand()
|
||||||
if cmd.len == 0 or cmd ==? "help" or cmd == "nop":
|
if cmd.len == 0 or cmd ==? "help":
|
||||||
setCommand "nop"
|
setCommand "help"
|
||||||
writeTask(astToStr(name), description)
|
writeTask(astToStr(name), description)
|
||||||
elif cmd ==? astToStr(name):
|
elif cmd ==? astToStr(name):
|
||||||
setCommand "nop"
|
setCommand "nop"
|
||||||
`name Task`()
|
`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
|
var
|
||||||
packageName* = ""
|
packageName* = ""
|
||||||
version*, author*, description*, license*, srcdir*,
|
version*, author*, description*, license*, srcdir*,
|
||||||
|
|
@ -173,7 +158,7 @@ var
|
||||||
|
|
||||||
skipDirs*, skipFiles*, skipExt*, installDirs*, installFiles*,
|
skipDirs*, skipFiles*, skipExt*, installDirs*, installFiles*,
|
||||||
installExt*, bin*: seq[string]
|
installExt*, bin*: seq[string]
|
||||||
requiresData*: seq[(string, VersionReq)]
|
requiresData*: seq[string]
|
||||||
|
|
||||||
proc requires*(name: string; v: VersionReq) =
|
proc requires*(deps: varargs[string]) =
|
||||||
requiresData.add((name, v))
|
for d in deps: requiresData.add(d)
|
||||||
|
|
|
||||||
8
todo.txt
8
todo.txt
|
|
@ -15,10 +15,6 @@ version 0.11.4
|
||||||
|
|
||||||
- add "all threads are blocked" detection to 'spawn'
|
- add "all threads are blocked" detection to 'spawn'
|
||||||
- Deprecate ``immediate`` for templates and macros
|
- Deprecate ``immediate`` for templates and macros
|
||||||
- make 'nil' work for 'add':
|
|
||||||
- resizeString
|
|
||||||
- incrSeq
|
|
||||||
- addChar
|
|
||||||
|
|
||||||
|
|
||||||
version 1.0
|
version 1.0
|
||||||
|
|
@ -36,6 +32,10 @@ version 1.0
|
||||||
- split docgen into separate tool
|
- split docgen into separate tool
|
||||||
- special rule for ``[]=``, items, pairs
|
- special rule for ``[]=``, items, pairs
|
||||||
- BUG: echo with template `$`*(info: TLineInfo): expr = toFileLineCol(info)
|
- BUG: echo with template `$`*(info: TLineInfo): expr = toFileLineCol(info)
|
||||||
|
- make 'nil' work for 'add':
|
||||||
|
- resizeString
|
||||||
|
- incrSeq
|
||||||
|
- addChar
|
||||||
|
|
||||||
|
|
||||||
Concurrency
|
Concurrency
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue