Syntax for incorporating variables in command argument
Goal is to enable injecting in the commands values coming from
- some user input (see #404)
- cargo, eg the MSRV to have a
cargo +1.77 checktask (see #407) - variables defined in the bacon.toml file (may be overriden per task, prefs, etc.)
- bacon itself (eg the name of the last failing test)
- other...
I'm not settled on a syntax right now but it must support arguments.
Maybe something like
[jobs.ex-ask]
vars.MSRV = "cargo::msrv"
command = [
"cargo",
"+${MSRV}",
"check",
"--all-targets",
]
# A task dedicated to checking cargo can be compiled with the MSRV
[jobs.check-msrv]
vars.example_name = {
source = "user::input",
question = "Name of the example to run?"
}
command = ["cargo", "run", "--example", "${example_name}"]
An alternative to a new vars collection would be to leverage the existing env one, that is
- making it possible for
envvariables to be dynamically set up similarly to the above example - interpret
${MSRV}in a command argument to interpolate with the env value
This is a great idea. Been a bit preoccupied of late. Saw this idea and wanted to second it. Happy to do some testing on this once you have a PoC or give feedback on ideas if desirable.
I think the ${MSRV} syntax is readily readable and if I'm not mistaken shouldn't conflict on any of the OS with their "normal" shell syntax. I think given how we execute the commands we don't actually need to worry about the shell processing what we pass in the end but still better to not mislead users.