-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
FixPendingIssues that have a fix which has not yet been reviewed or submitted.Issues that have a fix which has not yet been reviewed or submitted.FrozenDueToAgeProposalProposal-Acceptedearly-in-cycleA change that should be done early in the 3 month dev cycle.A change that should be done early in the 3 month dev cycle.
Milestone
Description
The text/template doc says:
{{if pipeline}} T1 {{else if pipeline}} T0 {{end}}
To simplify the appearance of if-else chains, the else action
of an if may include another if directly; the effect is exactly
the same as writing
{{if pipeline}} T1 {{else}}{{if pipeline}} T0 {{end}}{{end}}
However, no such "else with" counterpart exists:
{{with pipeline}} T1 {{else}} T0 {{end}}
If the value of the pipeline is empty, dot is unaffected and T0
is executed; otherwise, dot is set to the value of the pipeline
and T1 is executed.
Which would be very useful:
{{ with .foo.bar.baz }}
{{ . }}
{{ else with .foo.bar.bez }}
{{ . }}
{{ else with .foo.bar.biz }}
{{ . }}
{{ end }}
Currently, we must do the nesting that the else/if doc mentions:
{{ with .foo.bar.baz }}
{{ . }}
{{ else }}
{{ with .foo.bar.bez }}
{{ . }}
{{ else }}
{{ with .foo.bar.biz }}
{{ . }}
{{ end }}
{{ end }}
{{ end }}
This gets tiresome.
Mixing the two would also be useful:
{{ if .foo.bar.baz }}
{{ .quux }}
{{ else with .foo.bar.bez }}
{{ . }}
{{ else if .foo.bar.biz }}
{{ .boz }}
{{ end }}
arp242, alker0, hugo-sid, bep, brycewray and 12 more
Metadata
Metadata
Assignees
Labels
FixPendingIssues that have a fix which has not yet been reviewed or submitted.Issues that have a fix which has not yet been reviewed or submitted.FrozenDueToAgeProposalProposal-Acceptedearly-in-cycleA change that should be done early in the 3 month dev cycle.A change that should be done early in the 3 month dev cycle.