I'm in the process of designing a task-executor DSL.
Example:
{:tasks {:clean [:shell "rm" "-rf" "target"]}}
I want to be able to give a task a description and possibly more options. So I thought I can do:
{:tasks {:clean [:shell {:task/description "foo"} "rm" "-rf" "target"]}}
but this reads a bit weird, because I expect :shell
to get shell-related options and not some general task options.
One alternative I came up with:
{:tasks {:clean ^{:task/description "foo"} [:shell "rm" "-rf" "target"]}}
A bit ugly maybe, but semantically correct: the metadata is about the task. However, processing EDN with metadata, it can be done, but it might lead to confusion.
The other alternative, an explicit :task
wrapper if you want to provide options:
{:tasks {:clean [:task {:description "foo"} [:shell "rm" "-rf" "target"]]}}
I wonder if you came across similar problems when designing malli, I'd love to hear your feedback.I think malli more or less ended up with:
{:tasks {:clean [:shell {:description "Clean all the things"} "rm" "-rf" "target"]}}
right?