1- package main
1+ package cmd_analyze //nolint:stylecheck
22
33import (
44 "fmt"
@@ -9,16 +9,11 @@ import (
99 "github.com/urfave/cli/v2"
1010 "github.com/xitongsys/parquet-go-source/local"
1111 "github.com/xitongsys/parquet-go/reader"
12- "go.uber.org/zap"
1312)
1413
1514var (
16- version = "dev" // is set during build process
17- debug = os .Getenv ("DEBUG" ) == "1"
18- maxTxs = common .GetEnvInt ("MAX" , 0 ) // 0 means no limit
19-
20- // Helpers
21- log * zap.SugaredLogger
15+ debug = os .Getenv ("DEBUG" ) == "1"
16+ maxTxs = common .GetEnvInt ("MAX" , 0 ) // 0 means no limit
2217
2318 // CLI flags
2419 cliFlags = []cli.Flag {
@@ -34,41 +29,25 @@ var (
3429 Name : "out" ,
3530 Usage : "output filename" ,
3631 },
37- // &cli.StringSliceFlag{
38- // Name: "tx-blacklist",
39- // Usage: "metadata CSV/ZIP input files with transactions to ignore in analysis",
40- // },
41- // &cli.StringSliceFlag{
42- // Name: "tx-whitelist",
43- // Usage: "metadata CSV/ZIP input files to only use transactions in there for analysis",
44- // },
4532 & cli.StringSliceFlag {
4633 Name : "cmp" ,
4734 Usage : "compare these sources" ,
4835 },
4936 }
5037)
5138
52- func main () {
53- log = common .GetLogger (debug , false )
54- defer func () { _ = log .Sync () }()
55-
56- app := & cli.App {
57- Name : "analyze" ,
58- Usage : "Analyze transaction and sourcelog files" ,
59- Flags : cliFlags ,
60- Action : analyzeV2 ,
61- }
62-
63- if err := app .Run (os .Args ); err != nil {
64- log .Fatal (err )
65- }
39+ var Command = cli.Command {
40+ Name : "analyze" ,
41+ Usage : "Analyze transaction and sourcelog files" ,
42+ Flags : cliFlags ,
43+ Action : analyzeV2 ,
6644}
6745
6846func analyzeV2 (cCtx * cli.Context ) error {
47+ log := common .GetLogger (debug , false )
48+ defer func () { _ = log .Sync () }()
49+
6950 outFile := cCtx .String ("out" )
70- // ignoreTxsFiles := cCtx.StringSlice("tx-blacklist")
71- // whitelistTxsFiles := cCtx.StringSlice("tx-whitelist")
7251 parquetInputFiles := cCtx .StringSlice ("input-parquet" )
7352 inputSourceLogFiles := cCtx .StringSlice ("input-sourcelog" )
7453 cmpSources := cCtx .StringSlice ("cmp" )
@@ -81,7 +60,7 @@ func analyzeV2(cCtx *cli.Context) error {
8160 log .Fatal ("no input-parquet files specified" )
8261 }
8362
84- log .Infow ("Analyzer V2" , "version" , version )
63+ log .Infow ("Analyzer V2" , "version" , common . Version )
8564 // log.Infow("Comparing:", "sources", sourceComps)
8665
8766 // Ensure output files are don't yet exist
0 commit comments