rl_json
rl_json copied to clipboard
Request: Execute Commands in Templates
I have run into a few situations where it would be very helpful to allow executing of a command rather than substitution of a variable when running a template (with the ability to use variables if possible. I can of course set the variables before running the template, but in situations where I use the template from multiple procedures and need to update a value it definitely will be greatly beneficial to have.
I was thinking if there is a worry about substituting the commands directly that perhaps appending C could mean that it should also run any commands in the string? I could of course create all those situations where I just have a variable to directly reference but there are often times that ends up running into some messy situations, especially since many times i want to reference something that is not stored as a directly accessible variable.
Just a thought, obviously easy enough to work around it - just feel it kind of fits into the concept.
{
"authToken": "~SC:[authToken]",
"localTimestamp": "~NC:[clock milliseconds]",
"payload": "~TC:[dict get $::JSON::Templates $request]"
}
Obviously this also opens some other interesting capabilities like generating templates through return values of commands, etc.
An alternative for this use case might be to just use variable traces. Add a read trace on a variable that maps to the command you want to execute. The existing syntax need not change.