Description
I've found myself writing a lot of echo "<explanation of what next cmd does> commands with the silent: true property set, whenever I'm writing tasks for my users.
Let's pretend we want to supply a task that creates a file given via CLI_ARGS, without disclosing to our users what magic we used to do so (because of reasons). Currently, I would have to write something like this:
version: 3
tasks:
create-file:
cmds:
- cmd: echo "Creating requested file at {{ .CLI_ARGS }}..."
silent: true
- cmd: touch {{ .CLI_ARGS }}
silent: true
- cmd: echo "done!"
silent: true
output:
> task create-file -- foo.txt
Creating requested file at foo.txt...
done!
This bloats the task, and makes it tedious to write and parse.
My request would be a new echo field, which would implicitly set silent: true on the command object, and print the echo field's value instead when it's run. Also, allowing it to be the only field set would do away
with all the { cmd: "echo <msg>", "silent": true} constructs:
version: 3
tasks:
create-file:
cmds:
- echo : Creating requested file at {{ .CLI_ARGS }}...
cmd: touch {{ .CLI_ARGS }}
- echo: done!
The output should be identical:
> task create-file -- foo.txt
Creating requested file at foo.txt...
done!
In summary:
Add a new field echo to the command object:
- When set to a non-empty string, its value is printed to stdout and the object's
silent property implicitly set to true
- When no
cmd or defer attribute is set, the command should behave identical to { cmd: "echo <msg>", "silent": true}
Description
I've found myself writing a lot of
echo "<explanation of what next cmd does>commands with thesilent: trueproperty set, whenever I'm writing tasks for my users.Let's pretend we want to supply a task that creates a file given via CLI_ARGS, without disclosing to our users what magic we used to do so (because of reasons). Currently, I would have to write something like this:
output:
This bloats the task, and makes it tedious to write and parse.
My request would be a new
echofield, which would implicitly setsilent: trueon the command object, and print theechofield's value instead when it's run. Also, allowing it to be the only field set would do awaywith all the
{ cmd: "echo <msg>", "silent": true}constructs:The output should be identical:
In summary:
Add a new field
echoto thecommandobject:silentproperty implicitly set totruecmdordeferattribute is set, the command should behave identical to{ cmd: "echo <msg>", "silent": true}