Skip to content

Commit

Permalink
Document that proc named fooTask is created for every foo task [backp…
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushalmodi authored and EchoPouet committed Jun 13, 2020
1 parent abc1cdf commit 8ade84d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/system/nimscript.nim
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,26 @@ when not defined(nimble):
template `==?`(a, b: string): bool = cmpIgnoreStyle(a, b) == 0
template task*(name: untyped; description: string; body: untyped): untyped =
## Defines a task. Hidden tasks are supported via an empty description.
##
## Example:
##
## .. code-block:: nim
## task build, "default build is via the C backend":
## 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`*() =
setCommand "nop"
body
Expand Down

0 comments on commit 8ade84d

Please sign in to comment.