arctic-hen7 / bonnie

Simple, cross-platform, and fast command aliases with superpowers.
MIT License
83 stars 6 forks source link

Add multi-stage commands #11

Closed arctic-hen7 closed 3 years ago

arctic-hen7 commented 3 years ago

This is a big one, and would make Bonnie far more viable as a build tool. All this would take is accepting an array of commands for the cmd property and further support in shorthand notation.

That itself should be pretty easy, but what may be a challenge is control flow between steps. Complex control flow like checking whether a command outputted a certain thing, whether a file exists etc. is the realm of a full scripting language like BASH, but I think Bonnie should certainly provide checks as to whether a command succeeded or failed at least. I'll leave the form of that open right now.

arctic-hen7 commented 3 years ago

To link this to command domains, I would propose adding an optional order array property for if something like control flow is needed. Then, the user defines each part of their command as a subcommand as per the domains spec, and then they specify the order of execution by referring to those subcommands by name in the order property.

Further, we can add some kind of syntax to create conditional flow checking, like a comma followed by some special string like must_succeed. That kind of syntax lets users potentially even skip certain stages in certain cases.