| 200 | } |
| 201 | |
| 202 | func 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 | |
| 231 | func runCheck(args []string) { |
| 232 | fs := flag.NewFlagSet("check", flag.ExitOnError) |