Fix custom task template.
This commit is contained in:
parent
f9c54f7607
commit
2145f266e1
2 changed files with 6 additions and 5 deletions
|
|
@ -40,12 +40,12 @@ when not declared(task):
|
||||||
proc `name Task`*() = body
|
proc `name Task`*() = body
|
||||||
|
|
||||||
let cmd = getCommand()
|
let cmd = getCommand()
|
||||||
if cmd.len == 0 or cmd ==? "help":
|
if cmd.len == 0 or cmd == "help":
|
||||||
setCommand "help"
|
setCommand "help"
|
||||||
writeTask(astToStr(name), description)
|
echo(astToStr(name), " ", description)
|
||||||
elif cmd ==? astToStr(name):
|
elif cmd == astToStr(name):
|
||||||
setCommand "nop"
|
setCommand "nop"
|
||||||
`name Task`()
|
`name Task`()
|
||||||
|
|
||||||
template before*(action: untyped, body: untyped): untyped =
|
template before*(action: untyped, body: untyped): untyped =
|
||||||
## Defines a block of code which is evaluated before ``action`` is executed.
|
## Defines a block of code which is evaluated before ``action`` is executed.
|
||||||
|
|
|
||||||
|
|
@ -293,7 +293,8 @@ suite "nimscript":
|
||||||
test "can list nimscript tasks":
|
test "can list nimscript tasks":
|
||||||
cd "nimscript":
|
cd "nimscript":
|
||||||
let (output, exitCode) = execNimble("tasks")
|
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
|
check exitCode == QuitSuccess
|
||||||
|
|
||||||
test "can use pre/post hooks":
|
test "can use pre/post hooks":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue