Support for safe navigation in text templates

I realize that the safe navigation operators proposal was rejected, but is there any possibility of supporting ?. as an operator for the text/template package?

For example, in https://github.com/cli/cli/pull/3519 I added support to print a table using the same formatter that the GitHub CLI uses for built-in command output. But often times some fields from their GraphQL query are nested and I need to navigate into, say, .status.message where .status may be nil. I can use an {{if}} action with near-duplicates of the rest of the template, but 1) it gets very unwieldy, and 2) gets even more unwieldy if someone wants to drill down into more than one nested node.

Given text/template is already its own little special language, would it be acceptable to at least proposal (perhaps even implement) support for safe navigation operators?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.