go-jira / jira

simple jira command line client in Go
Apache License 2.0
2.67k stars 326 forks source link

range in a cell #491

Open igbanam opened 1 year ago

igbanam commented 1 year ago

Is it possible to have a range in a cell?

I have something like this

    {{/* Components */ -}}
    {{- if .fields.components -}}
      {{- range .fields.components -}}
        {{- cell .name -}}
      {{end}}
    {{- else -}}
      {{- cell "<none>" -}}
    {{- end -}}

But when there is more than one component, the table breaks. If the table should have 5 columns, the ticket with more than one component has a row with 5 + C - 1 rows; where C is the number of components.

Ideally, I'd want the multiple components to be joined in the same cell block. Any ideas on this?

The closest I've come to trying to get this working is

    {{/* Components */ -}}
    {{- if .fields.components -}}
      {{- cell (join ', ' .fields.components) -}}
    {{- else -}}
      {{- cell "<none>" -}}
    {{- end -}}

But this throws an error since join expects an array and is getting a more complex object. — and there's no map to reduce the object into an array