Created
August 8, 2019 12:28
-
-
Save Araq/8f79e6a5448817281e367eb4c44846c8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
proc `name Task`*() = | |
setCommand "nop" | |
body | |
let cmd = getCommand() | |
if cmd.len == 0 or cmd ==? "help": | |
setCommand "help" | |
writeTask(astToStr(name), description) | |
elif cmd ==? astToStr(name): | |
`name Task`() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment