Fix custom task template.

This commit is contained in:
Dominik Picheta 2018-08-28 16:15:02 +01:00
commit 2145f266e1
2 changed files with 6 additions and 5 deletions

View file

@ -40,12 +40,12 @@ when not declared(task):
proc `name Task`*() = body
let cmd = getCommand()
if cmd.len == 0 or cmd ==? "help":
if cmd.len == 0 or cmd == "help":
setCommand "help"
writeTask(astToStr(name), description)
elif cmd ==? astToStr(name):
echo(astToStr(name), " ", description)
elif cmd == astToStr(name):
setCommand "nop"
`name Task`()
`name Task`()
template before*(action: untyped, body: untyped): untyped =
## Defines a block of code which is evaluated before ``action`` is executed.

View file

@ -293,7 +293,8 @@ suite "nimscript":
test "can list nimscript tasks":
cd "nimscript":
let (output, exitCode) = execNimble("tasks")
check "work test description".normalize in output.normalize
check "work".normalize in output.normalize
check "test description".normalize in output.normalize
check exitCode == QuitSuccess
test "can use pre/post hooks":