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

Method Create

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

Source from the content-addressed store, hash-verified

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