(config listConfig, projects queries.Projects, owner string)
| 153 | } |
| 154 | |
| 155 | func printResults(config listConfig, projects queries.Projects, owner string) error { |
| 156 | if len(projects.Nodes) == 0 { |
| 157 | return cmdutil.NewNoResultsError(fmt.Sprintf("No projects found for %s", owner)) |
| 158 | } |
| 159 | |
| 160 | tp := tableprinter.New(config.io, tableprinter.WithHeader("Number", "Title", "State", "ID")) |
| 161 | |
| 162 | cs := config.io.ColorScheme() |
| 163 | for _, p := range projects.Nodes { |
| 164 | tp.AddField( |
| 165 | strconv.Itoa(int(p.Number)), |
| 166 | tableprinter.WithTruncate(nil), |
| 167 | ) |
| 168 | tp.AddField(p.Title) |
| 169 | tp.AddField( |
| 170 | format.ProjectState(p), |
| 171 | tableprinter.WithColor(cs.ColorFromString(format.ColorForProjectState(p))), |
| 172 | ) |
| 173 | tp.AddField(p.ID, tableprinter.WithTruncate(nil)) |
| 174 | tp.EndRow() |
| 175 | } |
| 176 | |
| 177 | return tp.Render() |
| 178 | } |
no test coverage detected