MCPcopy Create free account
hub / github.com/cli/cli / runEditItem

Function runEditItem

pkg/cmd/project/item-edit/item_edit.go:225–255  ·  view source on GitHub ↗
(config editItemConfig)

Source from the content-addressed store, hash-verified

223}
224
225func runEditItem(config editItemConfig) error {
226 // resolve name-based flags (--owner/number/--url/--field/--value) into the
227 // ID-typed fields the mutations use, before any write happens.
228 if config.opts.url != "" || config.opts.field != "" {
229 resolved, err := resolveItemEditNames(config)
230 if err != nil {
231 return err
232 }
233 config = resolved
234 }
235
236 // when clear flag is used, remove value set to the corresponding field ID
237 if config.opts.clear {
238 return clearItemFieldValue(config)
239 }
240
241 // update draft issue
242 if config.opts.titleChanged || config.opts.bodyChanged {
243 return updateDraftIssue(config)
244 }
245
246 // update item values
247 if config.opts.text != "" || config.opts.numberChanged || config.opts.date != "" || config.opts.singleSelectOptionID != "" || config.opts.iterationID != "" {
248 return updateItemValues(config)
249 }
250
251 if _, err := fmt.Fprintln(config.io.ErrOut, "error: no changes to make"); err != nil {
252 return err
253 }
254 return cmdutil.SilentError
255}
256
257// resolveItemEditNames turns the name-based addressing flags into the node IDs
258// used by the field-value mutations: it resolves the project from

Callers 15

NewCmdEditItemFunction · 0.85
TestRunItemEdit_DraftFunction · 0.85
TestRunItemEdit_TextFunction · 0.85
TestRunItemEdit_NumberFunction · 0.85
TestRunItemEdit_DateFunction · 0.85

Calls 4

resolveItemEditNamesFunction · 0.85
clearItemFieldValueFunction · 0.85
updateDraftIssueFunction · 0.85
updateItemValuesFunction · 0.85

Tested by 15

TestRunItemEdit_DraftFunction · 0.68
TestRunItemEdit_TextFunction · 0.68
TestRunItemEdit_NumberFunction · 0.68
TestRunItemEdit_DateFunction · 0.68