diff options
author | Kaushal Modi <kaushal.modi@gmail.com> | 2020-05-02 11:50:27 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-02 17:50:27 +0200 |
commit | 0880f118d377f05067ddcdcf7788d2706c5f0c3a (patch) | |
tree | 0a9d7a998b3e181341116ae538d702317cb2a4e1 /lib | |
parent | 83547ec769d9c55b47a8d7a9e3cfc79aab09f977 (diff) | |
download | Nim-0880f118d377f05067ddcdcf7788d2706c5f0c3a.tar.gz |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/system/nimscript.nim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/system/nimscript.nim b/lib/system/nimscript.nim index 5b8622182..da5c291fa 100644 --- a/lib/system/nimscript.nim +++ b/lib/system/nimscript.nim @@ -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 |