MCPcopy
hub / github.com/cli/cli / runList

Function runList

pkg/cmd/project/field-list/field_list.go:74–101  ·  view source on GitHub ↗
(config listConfig)

Source from the content-addressed store, hash-verified

72}
73
74func runList(config listConfig) error {
75 canPrompt := config.io.CanPrompt()
76 owner, err := config.client.NewOwner(canPrompt, config.opts.owner)
77 if err != nil {
78 return err
79 }
80
81 // no need to fetch the project if we already have the number
82 if config.opts.number == 0 {
83 canPrompt := config.io.CanPrompt()
84 project, err := config.client.NewProject(canPrompt, owner, config.opts.number, false)
85 if err != nil {
86 return err
87 }
88 config.opts.number = project.Number
89 }
90
91 project, err := config.client.ProjectFields(owner, config.opts.number, config.opts.limit)
92 if err != nil {
93 return err
94 }
95
96 if config.opts.exporter != nil {
97 return config.opts.exporter.Write(config.io, project.Fields)
98 }
99
100 return printResults(config, project.Fields.Nodes, owner.Login)
101}
102
103func printResults(config listConfig, fields []queries.ProjectField, login string) error {
104 if len(fields) == 0 {

Callers 7

TestRunList_User_ttyFunction · 0.70
TestRunList_UserFunction · 0.70
TestRunList_OrgFunction · 0.70
TestRunList_MeFunction · 0.70
TestRunList_EmptyFunction · 0.70
TestRunList_JSONFunction · 0.70
NewCmdListFunction · 0.70

Calls 6

CanPromptMethod · 0.80
NewOwnerMethod · 0.80
NewProjectMethod · 0.80
ProjectFieldsMethod · 0.80
printResultsFunction · 0.70
WriteMethod · 0.65

Tested by 6

TestRunList_User_ttyFunction · 0.56
TestRunList_UserFunction · 0.56
TestRunList_OrgFunction · 0.56
TestRunList_MeFunction · 0.56
TestRunList_EmptyFunction · 0.56
TestRunList_JSONFunction · 0.56