Add --fields to notification & milestone listings #422

Merged
6543 merged 22 commits from noerw/tea:fields-flag into main 2022-09-13 19:08:19 +00:00
2 changed files with 9 additions and 9 deletions
Showing only changes of commit 0e802cd8e5 - Show all commits

View File

@ -14,7 +14,7 @@ import (
)
var fieldsFlag = flags.FieldsFlag(print.MilestoneFields, []string{
"title", "open/closed issues", "due date",
"title", "items", "duedate",
})
// CmdMilestonesList represents a sub command of milestones to list milestones

View File

@ -38,10 +38,10 @@ func MilestonesList(news []*gitea.Milestone, output string, fields []string) {
var MilestoneFields = []string{
"title",
"state",
"open items",
"closed items",
"open/closed issues",
"due date",
"items_open",
"items_closed",
"items",
6543 marked this conversation as resolved Outdated
Outdated
Review

not sure if these long and spaced column names are good, they are a not easy to apply:

tea ms -f 'open items,open/closed issues' ...

will see if I can come up with better values

not sure if these long and spaced column names are good, they are a not easy to apply: ``` tea ms -f 'open items,open/closed issues' ... ``` will see if I can come up with better values
Outdated
Review

agree 👍 - rest looks ready :)

agree :+1: - rest looks ready :)
Outdated
Review

@6543 I finally simplified the field names. I'm not exactly happy with the result, but it's good enough I guess.
This makes the PR breaking though, as we don't return the same fields anymore.

@6543 I finally simplified the field names. I'm not exactly happy with the result, but it's good enough I guess. This makes the PR breaking though, as we don't return the same fields anymore.
"duedate",
"description",
"created",
"updated",
@ -59,13 +59,13 @@ func (m printableMilestone) FormatField(field string, machineReadable bool) stri
return m.Title
case "state":
return string(m.State)
case "open items":
case "items_open":
return fmt.Sprintf("%d", m.OpenIssues)
case "closed items":
case "items_closed":
return fmt.Sprintf("%d", m.ClosedIssues)
case "open/closed issues": // for backwards compatibility
case "items":
return fmt.Sprintf("%d/%d", m.OpenIssues, m.ClosedIssues)
case "deadline", "due date":
case "duedate":
if m.Deadline != nil && !m.Deadline.IsZero() {
return FormatTime(*m.Deadline)
}