mirror of
https://gitea.com/gitea/tea.git
synced 2025-09-02 18:08:30 +02:00
Improved list output (#281)
remove unused debug var move outputList into a struct so we can add additional functionality for all list output rename list output to table.go make table sortable sort milestones sort milestones descending remove unnecessary if Co-authored-by: Norwin Roosen <git@nroo.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/281 Reviewed-by: khmarbaise <khmarbaise@noreply.gitea.io> Reviewed-by: 6543 <6543@obermui.de> Co-Authored-By: Norwin <noerw@noreply.gitea.io> Co-Committed-By: Norwin <noerw@noreply.gitea.io>
This commit is contained in:
@ -12,7 +12,6 @@ import (
|
||||
|
||||
// NotificationsList prints a listing of notification threads
|
||||
func NotificationsList(news []*gitea.NotificationThread, output string, showRepository bool) {
|
||||
var values [][]string
|
||||
headers := []string{
|
||||
"Type",
|
||||
"Index",
|
||||
@ -22,6 +21,8 @@ func NotificationsList(news []*gitea.NotificationThread, output string, showRepo
|
||||
headers = append(headers, "Repository")
|
||||
}
|
||||
|
||||
t := table{headers: headers}
|
||||
|
||||
for _, n := range news {
|
||||
if n.Subject == nil {
|
||||
continue
|
||||
@ -41,11 +42,10 @@ func NotificationsList(news []*gitea.NotificationThread, output string, showRepo
|
||||
if showRepository {
|
||||
item = append(item, n.Repository.FullName)
|
||||
}
|
||||
values = append(values, item)
|
||||
t.addRowSlice(item)
|
||||
}
|
||||
|
||||
if len(values) != 0 {
|
||||
outputList(output, headers, values)
|
||||
if t.Len() != 0 {
|
||||
t.print(output)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user