MCPcopy
hub / github.com/cli/cli / buildUpdateItem

Function buildUpdateItem

pkg/cmd/project/item-edit/item_edit.go:209–241  ·  view source on GitHub ↗
(config editItemConfig, date time.Time)

Source from the content-addressed store, hash-verified

207}
208
209func buildUpdateItem(config editItemConfig, date time.Time) (*UpdateProjectV2FieldValue, map[string]interface{}) {
210 var value githubv4.ProjectV2FieldValue
211 if config.opts.text != "" {
212 value = githubv4.ProjectV2FieldValue{
213 Text: githubv4.NewString(githubv4.String(config.opts.text)),
214 }
215 } else if config.opts.numberChanged {
216 value = githubv4.ProjectV2FieldValue{
217 Number: githubv4.NewFloat(githubv4.Float(config.opts.number)),
218 }
219 } else if config.opts.date != "" {
220 value = githubv4.ProjectV2FieldValue{
221 Date: githubv4.NewDate(githubv4.Date{Time: date}),
222 }
223 } else if config.opts.singleSelectOptionID != "" {
224 value = githubv4.ProjectV2FieldValue{
225 SingleSelectOptionID: githubv4.NewString(githubv4.String(config.opts.singleSelectOptionID)),
226 }
227 } else if config.opts.iterationID != "" {
228 value = githubv4.ProjectV2FieldValue{
229 IterationID: githubv4.NewString(githubv4.String(config.opts.iterationID)),
230 }
231 }
232
233 return &UpdateProjectV2FieldValue{}, map[string]interface{}{
234 "input": githubv4.UpdateProjectV2ItemFieldValueInput{
235 ProjectID: githubv4.ID(config.opts.projectID),
236 ItemID: githubv4.ID(config.opts.itemID),
237 FieldID: githubv4.ID(config.opts.fieldID),
238 Value: value,
239 },
240 }
241}
242
243func buildClearItem(config editItemConfig) (*ClearProjectV2FieldValue, map[string]interface{}) {
244 return &ClearProjectV2FieldValue{}, map[string]interface{}{

Callers 1

updateItemValuesFunction · 0.85

Calls 2

IDMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected