mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
simplify nimscript.nim
This commit is contained in:
@@ -355,7 +355,7 @@ proc mainCommand* =
|
||||
gGlobalOptions.incl(optCaasEnabled)
|
||||
msgs.gErrorMax = high(int) # do not stop after first error
|
||||
serve(mainCommand)
|
||||
of "nop": discard
|
||||
of "nop", "help": discard
|
||||
else:
|
||||
rawMessage(errInvalidCommandX, command)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
8
todo.txt
8
todo.txt
@@ -15,10 +15,6 @@ version 0.11.4
|
||||
|
||||
- add "all threads are blocked" detection to 'spawn'
|
||||
- Deprecate ``immediate`` for templates and macros
|
||||
- make 'nil' work for 'add':
|
||||
- resizeString
|
||||
- incrSeq
|
||||
- addChar
|
||||
|
||||
|
||||
version 1.0
|
||||
@@ -36,6 +32,10 @@ version 1.0
|
||||
- split docgen into separate tool
|
||||
- special rule for ``[]=``, items, pairs
|
||||
- BUG: echo with template `$`*(info: TLineInfo): expr = toFileLineCol(info)
|
||||
- make 'nil' work for 'add':
|
||||
- resizeString
|
||||
- incrSeq
|
||||
- addChar
|
||||
|
||||
|
||||
Concurrency
|
||||
|
||||
Reference in New Issue
Block a user