(io *iostreams.IOStreams, labels []label)
| 133 | } |
| 134 | |
| 135 | func printLabels(io *iostreams.IOStreams, labels []label) error { |
| 136 | cs := io.ColorScheme() |
| 137 | table := tableprinter.New(io, tableprinter.WithHeader("NAME", "DESCRIPTION", "COLOR")) |
| 138 | |
| 139 | for _, label := range labels { |
| 140 | // Colorize the label using tableprinter's WithColor function for it to handle non-TTY situations |
| 141 | labelColor := tableprinter.WithColor(func(s string) string { |
| 142 | return cs.Label(label.Color, s) |
| 143 | }) |
| 144 | |
| 145 | table.AddField(label.Name, labelColor) |
| 146 | table.AddField(label.Description) |
| 147 | table.AddField("#" + label.Color) |
| 148 | |
| 149 | table.EndRow() |
| 150 | } |
| 151 | |
| 152 | return table.Render() |
| 153 | } |
| 154 | |
| 155 | func listHeader(repoName string, count int, totalCount int) string { |
| 156 | return fmt.Sprintf("Showing %d of %s in %s", count, text.Pluralize(totalCount, "label"), repoName) |
no test coverage detected