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

Method Create

pkg/cmd/run/view/view.go:49–66  ·  view source on GitHub ↗
(key string, content io.Reader)

Source from the content-addressed store, hash-verified

47}
48
49func (c RunLogCache) Create(key string, content io.Reader) error {
50 if err := os.MkdirAll(c.cacheDir, 0755); err != nil {
51 return fmt.Errorf("creating cache directory: %v", err)
52 }
53
54 out, err := os.Create(c.filepath(key))
55 if err != nil {
56 return fmt.Errorf("creating cache entry: %v", err)
57 }
58 defer out.Close()
59
60 if _, err := io.Copy(out, content); err != nil {
61 return fmt.Errorf("writing cache entry: %v", err)
62
63 }
64
65 return nil
66}
67
68func (c RunLogCache) Open(key string) (*zip.ReadCloser, error) {
69 r, err := zip.OpenReader(c.filepath(key))

Callers 1

TestRunLogFunction · 0.95

Calls 5

filepathMethod · 0.95
ErrorfMethod · 0.65
CreateMethod · 0.65
CloseMethod · 0.65
CopyMethod · 0.45

Tested by 1

TestRunLogFunction · 0.76