File tree Expand file tree Collapse file tree 2 files changed +32
-7
lines changed Expand file tree Collapse file tree 2 files changed +32
-7
lines changed Original file line number Diff line number Diff line change 88rsort ($ results );
99
1010$ index = 0 ;
11- if (!empty ($ argv [1 ]) && $ argv [1 ] < count ($ results )) {
12- $ index = intval ($ argv [1 ]);
11+
12+ if (!empty ($ results [$ argv [1 ]])) {
13+ $ index = $ argv [1 ];
1314}
1415
1516if (preg_match ("/output\/(\S+)/ " , @$ results [$ index ], $ match )) {
16- echo "Results: " . @$ match [1 ] . PHP_EOL ;
17+ echo " Results: \t\t" . @$ match [1 ] . PHP_EOL ;
18+ }
19+
20+ $ compareTo = -1 ;
21+
22+ if (!empty ($ results [$ argv [2 ]])) {
23+ $ compareTo = $ argv [2 ];
24+ } else if (!empty ($ results [$ index +1 ])) {
25+ $ compareTo = $ index +1 ;
1726}
1827
28+ if ($ compareTo >=0 && preg_match ("/output\/(\S+)/ " , @$ results [$ compareTo ], $ match )) {
29+ echo " Compare to: \t\t" . @$ match [1 ] . PHP_EOL ;
30+ }
31+
32+ echo '|-------------------|------------------------:|-------------:|----------:|-------------:| ' .PHP_EOL ;
33+
1934$ pr = parse_results (@$ results [$ index ] . '/results.log ' );
2035
21- if ($ index + 1 >= count ( $ results ) ) {
36+ if ($ compareTo < 0 ) {
2237 echo build_table ($ pr );
2338} else {
24- $ prComp = parse_results (@$ results [$ index + 1 ] . '/results.log ' );
39+ $ prComp = parse_results (@$ results [$ compareTo ] . '/results.log ' );
2540 echo build_table ($ pr , $ prComp );
2641}
Original file line number Diff line number Diff line change @@ -9,9 +9,10 @@ function showHelp()
99{
1010 cat << HEREDOC
1111
12- Usage: bash results.sh [-l] [-t 1 ] [-d 2 ]
12+ Usage: bash results.sh [-t 0 ] [-c 3 ]
1313
1414 Optional Arguments:
15+ -c [index], --compare [index] Compare current results with (use --list)
1516 -d [index], --delete [index] Delete by index id (use --list)
1617 -dall, --deleteall Delete all results
1718 -h, --help Show this help message and exit
@@ -33,12 +34,20 @@ IFS=$oldIFS
3334
3435results=(` ls ./output/` )
3536index=0
37+ compare_to=1
3638for option in " ${params[@]} "
3739do
3840 case " $option " in
3941 -dall|--deleteall)
4042 rm -rf ./output/*
4143 ;;
44+ -c* |--compare* )
45+ compare=${option// --compare / }
46+ compare=${option// -c / }
47+ if [ ${# compare} -ge 0 ]; then
48+ compare_to=" $compare "
49+ fi
50+ ;;
4251 -d* |--delete* )
4352 delete=${option// --delete / }
4453 delete=${option// -d / }
6675 top=${option// -t / }
6776 if [ ${# top} -ge 0 ]; then
6877 index=" $top "
78+ compare_to=$index +1
6979 fi
7080 ;;
7181 -h|--help)
8090 esac
8191done
8292
83- php ./libs/show_results_table.php $index
93+ php ./libs/show_results_table.php $index $compare_to
You can’t perform that action at this time.
0 commit comments