(io *iostreams.IOStreams, now time.Time, results search.CommitsResult)
| 153 | } |
| 154 | |
| 155 | func displayResults(io *iostreams.IOStreams, now time.Time, results search.CommitsResult) error { |
| 156 | if now.IsZero() { |
| 157 | now = time.Now() |
| 158 | } |
| 159 | cs := io.ColorScheme() |
| 160 | tp := tableprinter.New(io, tableprinter.WithHeader("Repo", "SHA", "Message", "Author", "Created")) |
| 161 | for _, commit := range results.Items { |
| 162 | tp.AddField(commit.Repo.FullName) |
| 163 | tp.AddField(commit.Sha) |
| 164 | tp.AddField(text.RemoveExcessiveWhitespace(commit.Info.Message)) |
| 165 | tp.AddField(commit.Author.Login) |
| 166 | tp.AddTimeField(now, commit.Info.Author.Date, cs.Muted) |
| 167 | tp.EndRow() |
| 168 | } |
| 169 | if io.IsStdoutTTY() { |
| 170 | header := fmt.Sprintf("Showing %d of %d commits\n\n", len(results.Items), results.Total) |
| 171 | fmt.Fprintf(io.Out, "\n%s", header) |
| 172 | } |
| 173 | return tp.Render() |
| 174 | } |
no test coverage detected