@@ -30,8 +30,11 @@ func run(args []string) error {
3030 flags .StringVar (& config .target , "target" , "" , "the target under analysis" )
3131 flags .StringVar (& config .beforeFile , "before" , "" , "filepath to aquery file (before)" )
3232 flags .StringVar (& config .afterFile , "after" , "" , "filepath to aquery file (after)" )
33+ flags .StringVar (& config .matchingStrategy , "match" , "output_files" , "method used to build mapping of before & after actions (output_files|mnemonic)" )
3334 flags .StringVar (& config .reportDir , "report_dir" , "" , "path to directory where report files should be written" )
3435 flags .StringVar (& config .port , "port" , "8000" , "port number to use when serving content" )
36+ flags .BoolVar (& config .unidiff , "unidiff" , false , "compute unidiffs (can be slow)" )
37+ flags .BoolVar (& config .cmpdiff , "cmpdiff" , true , "compute go-cmp diffs (usually fast)" )
3538 flags .BoolVar (& config .serve , "serve" , false , "start webserver" )
3639 flags .BoolVar (& config .open , "open" , false , "open browser to webserver URL" )
3740 if err := flags .Parse (args ); err != nil {
@@ -71,7 +74,21 @@ func run(args []string) error {
7174 return err
7275 }
7376
74- beforeOnly , afterOnly , both := action .Partition (beforeGraph .OutputMap , afterGraph .OutputMap )
77+ var mapper action.ActionMapper
78+ switch config .matchingStrategy {
79+ case "output_files" :
80+ mapper = action .NewOutputFilesMap
81+ case "mnemonic" :
82+ mapper = action .NewMnemonicFileMap
83+ default :
84+ return fmt .Errorf ("unknown matching strategy '%s'" , config .matchingStrategy )
85+ }
86+
87+ beforeOnly , afterOnly , both := action .Partition (
88+ mapper (beforeGraph .Actions ),
89+ mapper (afterGraph .Actions ),
90+ )
91+
7592 var equal action.OutputPairs
7693 var nonEqual action.OutputPairs
7794
@@ -97,6 +114,8 @@ func run(args []string) error {
97114 AfterOnly : afterOnly ,
98115 Equal : equal ,
99116 NonEqual : nonEqual ,
117+ Unidiff : config .unidiff ,
118+ Cmpdiff : config .cmpdiff ,
100119 }
101120
102121 log .Printf ("Generating report in: %s" , config .reportDir )
0 commit comments