MCPcopy Create free account
hub / github.com/XmirrorSecurity/OpenSCA-cli / outWrite

Function outWrite

cmd/format/save.go:105–127  ·  view source on GitHub ↗
(out string, do func(io.Writer) error)

Source from the content-addressed store, hash-verified

103}
104
105func outWrite(out string, do func(io.Writer) error) {
106
107 if out == "" {
108 do(os.Stdout)
109 return
110 }
111
112 if err := os.MkdirAll(filepath.Dir(out), 0777); err != nil {
113 logs.Warn(err)
114 fmt.Println(err)
115 return
116 }
117
118 w, err := os.Create(out)
119 if err != nil {
120 logs.Warn(err)
121 } else {
122 defer w.Close()
123 if err = do(w); err != nil {
124 logs.Warn(err)
125 }
126 }
127}

Callers 15

SarifFunction · 0.85
CsvFunction · 0.85
HtmlFunction · 0.85
CycloneDXJsonFunction · 0.85
CycloneDXXmlFunction · 0.85
XmlFunction · 0.85
BomSWJsonFunction · 0.85
swidZipFunction · 0.85
SpdxFunction · 0.85
SpdxJsonFunction · 0.85
SpdxXmlFunction · 0.85
DsdxFunction · 0.85

Calls 2

WarnFunction · 0.92
CloseMethod · 0.45

Tested by

no test coverage detected