You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The cmd! macro is great: commands are quickly written, very readable, and whitespace-safe. However, when the shell scripting becomes a bit more complicated, one quickly hits a frustrating limitation: I have a lot of cmd! invocations in my script that are very similar, but there is no good way to abstract the commonalities into a helper function. The problem is that the cmd! macro can be used only exactly once per command, so it's not possible to have a helper prepare a Cmd value with all the things that are common across my script and then later conveniently add more arguments to it.
In my case, what I'd like to be able to do looks roughly like this:
But currently, I have to instead either repeat the cargo +{toolchain} {subcommand} {cargo_extra_flags...} --manifest-path={manifest_path} part everywhere or write
The
cmd!
macro is great: commands are quickly written, very readable, and whitespace-safe. However, when the shell scripting becomes a bit more complicated, one quickly hits a frustrating limitation: I have a lot ofcmd!
invocations in my script that are very similar, but there is no good way to abstract the commonalities into a helper function. The problem is that thecmd!
macro can be used only exactly once per command, so it's not possible to have a helper prepare aCmd
value with all the things that are common across my script and then later conveniently add more arguments to it.In my case, what I'd like to be able to do looks roughly like this:
But currently, I have to instead either repeat the
cargo +{toolchain} {subcommand} {cargo_extra_flags...} --manifest-path={manifest_path}
part everywhere or writewhich is a lot less readable than what one can do with
cmd!
.The text was updated successfully, but these errors were encountered: