Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Placing
pre.erb
in-front of another command will allow dynmaic templating via Ruby's ERB syntax.For example:
When this runs, it will first replace the template with the result of the ERB. It would be the same as this:
The binding (variable and method scope) for
pre.erb
is shared across all executions and the defaultprint.erb
command. That means you can use it to persist data or logic and re-use it:When run, this would produce:
Multi-line commands are also supported
The only thing to watch out for is if the resulting template contains a
:::>>
(or similar) rundoc marker at the beginning of the line; Rundoc will think it is a new command rather than a part ofpre.erb
template.The visibility of the
pre.erb
is forwarded to whatever command is run.