fix(discussion list): use separate list of fields

Signed-off-by: Babak K. Shandiz <babakks@github.com>
This commit is contained in:
Babak K. Shandiz 2026-04-14 11:45:55 +01:00
parent 0687a29e51
commit 3f52503a67
No known key found for this signature in database
GPG key ID: 9472CAEFF56C742E

View file

@ -20,6 +20,27 @@ import (
const defaultLimit = 30
var discussionListFields = []string{
"id",
"number",
"title",
"body",
"url",
"state",
"stateReason",
"author",
"category",
"labels",
"answered",
"answerChosenAt",
"answerChosenBy",
"reactionGroups",
"createdAt",
"updatedAt",
"closedAt",
"locked",
}
// ListOptions holds the configuration for the discussion list command.
type ListOptions struct {
IO *iostreams.IOStreams
@ -105,7 +126,7 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
cmd.Flags().StringVarP(&opts.Search, "search", "S", "", "Search discussions with `query`")
cmd.Flags().StringVar(&opts.After, "after", "", "Cursor for the next page of results")
cmd.Flags().BoolVarP(&opts.WebMode, "web", "w", false, "List discussions in the web browser")
cmdutil.AddJSONFlags(cmd, &opts.Exporter, shared.DiscussionFields)
cmdutil.AddJSONFlags(cmd, &opts.Exporter, discussionListFields)
return cmd
}