Document that proc named fooTask is created for every foo task [backport] (#14187)
Ref: https://irclogs.nim-lang.org/01-05-2020.html#15:18:03
This commit is contained in:
parent
83547ec769
commit
0880f118d3
1 changed files with 15 additions and 0 deletions
|
|
@ -379,11 +379,26 @@ when not defined(nimble):
|
||||||
template `==?`(a, b: string): bool = cmpIgnoreStyle(a, b) == 0
|
template `==?`(a, b: string): bool = cmpIgnoreStyle(a, b) == 0
|
||||||
template task*(name: untyped; description: string; body: untyped): untyped =
|
template task*(name: untyped; description: string; body: untyped): untyped =
|
||||||
## Defines a task. Hidden tasks are supported via an empty description.
|
## Defines a task. Hidden tasks are supported via an empty description.
|
||||||
|
##
|
||||||
## Example:
|
## Example:
|
||||||
##
|
##
|
||||||
## .. code-block:: nim
|
## .. code-block:: nim
|
||||||
## task build, "default build is via the C backend":
|
## task build, "default build is via the C backend":
|
||||||
## setCommand "c"
|
## setCommand "c"
|
||||||
|
##
|
||||||
|
## For a task named ``foo``, this template generates a ``proc`` named
|
||||||
|
## ``fooTask``. This is useful if you need to call one task in
|
||||||
|
## another in your Nimscript.
|
||||||
|
##
|
||||||
|
## Example:
|
||||||
|
##
|
||||||
|
## .. code-block:: nim
|
||||||
|
## task foo, "foo": # > nim foo
|
||||||
|
## echo "Running foo" # Running foo
|
||||||
|
##
|
||||||
|
## task bar, "bar": # > nim bar
|
||||||
|
## echo "Running bar" # Running bar
|
||||||
|
## fooTask() # Running foo
|
||||||
proc `name Task`*() =
|
proc `name Task`*() =
|
||||||
setCommand "nop"
|
setCommand "nop"
|
||||||
body
|
body
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue