MCPcopy
hub / github.com/six2dez/OneListForAll / runStats

Function runStats

cmd/olfa/main.go:202–229  ·  view source on GitHub ↗
(args []string)

Source from the content-addressed store, hash-verified

200}
201
202func runStats(args []string) {
203 fs := flag.NewFlagSet("stats", flag.ExitOnError)
204 configPath := fs.String("config", "configs/pipeline.yml", "config file path")
205 outputDir := fs.String("output-dir", ".", "output directory")
206 format := fs.String("format", "table", "table|json")
207 _ = fs.Parse(args)
208
209 cfg, err := config.Load(*configPath)
210 if err != nil {
211 die(err)
212 }
213 res, err := stats.Run(*outputDir, cfg.Release.Outputs)
214 if err != nil {
215 die(err)
216 }
217
218 if *format == "json" {
219 enc := json.NewEncoder(os.Stdout)
220 enc.SetIndent("", " ")
221 _ = enc.Encode(res)
222 return
223 }
224
225 fmt.Println("OneListForAll Statistics")
226 for _, e := range res.Entries {
227 fmt.Printf("- %s: lines=%d size=%d bytes\n", e.Name, e.Lines, e.Bytes)
228 }
229}
230
231func runCheck(args []string) {
232 fs := flag.NewFlagSet("check", flag.ExitOnError)

Callers 1

mainFunction · 0.85

Calls 3

LoadFunction · 0.92
RunFunction · 0.92
dieFunction · 0.85

Tested by

no test coverage detected