MCPcopy Index your code
hub / github.com/cli/cli / openUserFile

Function openUserFile

pkg/cmd/api/api.go:611–627  ·  view source on GitHub ↗
(fn string, stdin io.ReadCloser)

Source from the content-addressed store, hash-verified

609}
610
611func openUserFile(fn string, stdin io.ReadCloser) (io.ReadCloser, int64, error) {
612 if fn == "-" {
613 return stdin, -1, nil
614 }
615
616 r, err := os.Open(fn)
617 if err != nil {
618 return r, -1, err
619 }
620
621 s, err := os.Stat(fn)
622 if err != nil {
623 return r, -1, err
624 }
625
626 return r, s.Size(), nil
627}
628
629func parseErrorResponse(r io.Reader, statusCode int) (io.Reader, string, error) {
630 bodyCopy := &bytes.Buffer{}

Callers 2

apiRunFunction · 0.85
Test_openUserFileFunction · 0.85

Calls 2

OpenMethod · 0.80
SizeMethod · 0.65

Tested by 1

Test_openUserFileFunction · 0.68