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

Function startProgressBar

main.go:182–213  ·  view source on GitHub ↗
(arg *opensca.TaskArg)

Source from the content-addressed store, hash-verified

180}
181
182func startProgressBar(arg *opensca.TaskArg) (stop func()) {
183
184 progress := true
185
186 var find, deps, bar int
187
188 go func() {
189 logos := []string{`[ ]`, `[= ]`, `[== ]`, `[===]`, `[ ==]`, `[ =]`, `[ ]`, `[ =]`, `[ ==]`, `[===]`, `[== ]`, `[= ]`}
190 for progress {
191 fmt.Printf("\r%s file:%d dependencies:%d", logos[bar], find, deps)
192 bar = (bar + 1) % len(logos)
193 <-time.After(time.Millisecond * 100)
194 }
195 }()
196
197 // 记录解析过的文件及依赖
198 arg.ResCallFunc = func(file *model.File, root ...*model.DepGraph) {
199 find++
200 for _, dep := range root {
201 dep.ForEachNode(func(p, n *model.DepGraph) bool {
202 if n.Name != "" {
203 deps++
204 }
205 return true
206 })
207 }
208 }
209
210 return func() {
211 progress = false
212 }
213}
214
215func taskReport(r opensca.TaskResult) format.Report {
216

Callers 1

mainFunction · 0.85

Calls 1

ForEachNodeMethod · 0.80

Tested by

no test coverage detected