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

Function updateGist

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

Source from the content-addressed store, hash-verified

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

Callers 1

editRunFunction · 0.70

Calls 3

JoinPathFunction · 0.92
RESTMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected