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
Showing only changes of commit 1798864fb2 - Show all commits

View File

@ -15,11 +15,11 @@ import (
"github.com/urfave/cli/v2"
)
var notifFieldsFlag = flags.FieldsFlag(print.NotificationFields, []string{
var notifyFieldsFlag = flags.FieldsFlag(print.NotificationFields, []string{
noerw marked this conversation as resolved Outdated
Outdated
Review

typo?

typo?
"id", "status", "index", "type", "state", "title",
})
var notifTypeFlag = flags.NewCsvFlag("types", "subject types to filter by", []string{"t"},
var notifyTypeFlag = flags.NewCsvFlag("types", "subject types to filter by", []string{"t"},
[]string{"issue", "pull", "repository", "commit"}, nil)
// CmdNotificationsList represents a sub command of notifications to list notifications
@ -31,8 +31,8 @@ var CmdNotificationsList = cli.Command{
ArgsUsage: " ", // command does not accept arguments
Action: RunNotificationsList,
Flags: append([]cli.Flag{
notifFieldsFlag,
notifTypeFlag,
notifyFieldsFlag,
notifyTypeFlag,
}, flags.NotificationFlags...),
}
@ -48,7 +48,7 @@ func RunNotificationsList(ctx *cli.Context) error {
}
var types []gitea.NotifySubjectType
typesStr, err := notifTypeFlag.GetValues(ctx)
typesStr, err := notifyTypeFlag.GetValues(ctx)
if err != nil {
return err
}
@ -74,7 +74,7 @@ func listNotifications(cmd *cli.Context, status []gitea.NotifyStatus, subjects [
listOpts.Page = 1
}
fields, err := notifFieldsFlag.GetValues(cmd)
fields, err := notifyFieldsFlag.GetValues(cmd)
if err != nil {
return err
}