New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support f-strings #1
Comments
Though one problem is that let foo = "bar";
bash!("echo ${foo}") that'd be hard to resolve without actually parsing the whole script to figure out whether One possibly related idea: change things so that rather than replacing all variables in the script via substitution, we render things as e.g.: let foo = "bar";
bash!("echo ${foo}", foo); set -euo pipefail
foo='bar'
echo ${foo} IOW we require people to refer to injected variables via |
Maybe it's more ergonomic to move the bindings first too?
|
Or we only fstring-substitute variables prefixed with
|
OK so https://blog.rust-lang.org/2022/01/13/Rust-1.58.0.html#captured-identifiers-in-format-strings landed. I'm thinking the above mentioned code like:
would be most elegant. But as far as I can tell, all the machinery to handle The status quo today is that the underlying format_args is compiler internal. But, I would guess we could still do the same with a proc macro. The ugly part really of this is that we need to parse the input, but I guess we already depend on |
This crate would feel especially natural if we had "f-strings", see https://crates.io/crates/fstrings/
We could probably copy in that crate's code...the only thing we need to do is insert shell quotation. Perhaps we could extend the crate's macros to add something like
f_mapped!(crate::internals::command_arg, $fmt, ...)
.The text was updated successfully, but these errors were encountered: