Allow commands to use the previous commands template
It would be useful for certain commands to use the template of the previous command in the pipeline to render their data. For example commands like filter and sort, strip the template if they are ever used in a pipeline. In order to keep their template commands would need to implement their own filter functionality. This kinda defeats the purpose of pipelines.
Some implementation thoughts off the top of my head (not exhaustive or binding in any way!):
- Currently, at the beginning of a new stage, any previously accumulated template information is discarded. We'd need to preserve this for the most recently executed stage.
- Templates are resolved according to the bundle version of the currently executing command. We would need to record this when we record the template name to use in order to allow proper resolution.
- We might want a new output flag for Relay to implement this. Currently if standard output contains a line like:
COG_TEMPLATE: foo
then foo is the template we use. We could have another flag (perhaps COG_TEMPLATE_PRESERVE: true or somesuch) that commands could use to opt in to this behavior. That way it's not something reserved for filter and sort which are embedded commands that don't use Relay. That also doesn't involve sending previous template information into a command, which seems like a Not Good Idea.