@@ -199,7 +199,6 @@ def compare_matrixes(matrixes_list, matrixes_titles = matrixes_list.size, group_ warn 'Matrix cannot be empty!' return end
don't remove that line.
options = { 'perf-profile': 5, theme: :none }.merge(options) matrixes_values = get_matrixes_values(matrixes_list, options) remove_unchanged_field(matrixes_values)
@@ -375,7 +374,7 @@ end # compare each matrices_list within pre dimension of group matrices # input: group matrices # output: pre compare result of each group -def compare_group_matrices(group_matrices) +def compare_group_matrices(group_matrices, options) group_matrices.each do |k, v| matrices_list = [] matrices_titles = [] @@ -384,7 +383,7 @@ def compare_group_matrices(group_matrices) matrices_list << matrix end
- compare_matrixes(matrices_list, matrices_titles, k)
- compare_matrixes(matrices_list, matrices_titles, k, options: options) end
end
diff --git a/sbin/compare b/sbin/compare index bc63ace..c171894 100755 --- a/sbin/compare +++ b/sbin/compare @@ -10,6 +10,7 @@ # compare "commit=a12d232e" "commit=b3bacc31" # compare "os=debian" "os=centos" -c "suite=iperf" # compare "os=centos" -d "os_version os_arch" +# compare "os=centos" -d "os_version os_arch" --color -t light
require 'optparse' require_relative '../lib/compare.rb' @@ -17,6 +18,9 @@ require_relative '../lib/compare.rb' common_conditions = '' is_group = false dimensions = nil +theme = :classic +color = false +options = {}
opt_parser = OptionParser.new do |opts| opts.banner = 'Usage: compare "conditions" ... [option]' @@ -36,6 +40,14 @@ opt_parser = OptionParser.new do |opts| is_group = true end
- opts.on('-t', '--theme theme', 'theme to compare: classic/focus_good/focus_bad/striking/light') do |t|
- theme = t
- end
- opts.on('--color', 'turn on colorful display with current theme') do
- color = true
- end
这两个参数可以合并为一个吗?
--color none|classic|...
Thanks, Fengguang