MCPcopy
hub / github.com/cli/cli / updateGist

Function updateGist

pkg/cmd/gist/edit/edit.go:396–412  ·  view source on GitHub ↗
(apiClient *api.Client, hostname string, gist gistToUpdate)

Source from the content-addressed store, hash-verified

394}
395
396func updateGist(apiClient *api.Client, hostname string, gist gistToUpdate) error {
397 requestByte, err := json.Marshal(gist)
398 if err != nil {
399 return err
400 }
401
402 requestBody := bytes.NewReader(requestByte)
403 result := shared.Gist{}
404
405 path := "gists/" + gist.id
406 err = apiClient.REST(hostname, "POST", path, requestBody, &result)
407 if err != nil {
408 return err
409 }
410
411 return nil
412}
413
414func getFilesToAdd(file string, content []byte) (map[string]*gistFileToUpdate, error) {
415 if shared.IsBinaryContents(content) {

Callers 1

editRunFunction · 0.70

Calls 1

RESTMethod · 0.65

Tested by

no test coverage detected