Add debug option

This commit is contained in:
kojix2 2020-08-03 10:08:29 +09:00
parent 41a540c876
commit 1dce48cd2c

View File

@ -11,6 +11,7 @@ module Uplot
@transpose = false @transpose = false
@output = false @output = false
@count = false @count = false
@debug = false
parse_options(argv) parse_options(argv)
end end
@ -27,6 +28,7 @@ module Uplot
opt.on('-m', '--margin VAL', Numeric) { |v| @params[:margin] = v } opt.on('-m', '--margin VAL', Numeric) { |v| @params[:margin] = v }
opt.on('-p', '--padding VAL', Numeric) { |v| @params[:padding] = v } opt.on('-p', '--padding VAL', Numeric) { |v| @params[:padding] = v }
opt.on('-l', '--labels', TrueClass) { |v| @params[:labels] = v } opt.on('-l', '--labels', TrueClass) { |v| @params[:labels] = v }
opt.on('--debug', TrueClass){ |v| @debug = v }
end end
end end
@ -72,6 +74,7 @@ module Uplot
while input = Kernel.gets(nil) while input = Kernel.gets(nil)
input.freeze input.freeze
data, headers = preprocess(input) data, headers = preprocess(input)
pp data: data, headers: headers if @debug
case @ptype case @ptype
when 'hist', 'histogram' when 'hist', 'histogram'
histogram(data, headers) histogram(data, headers)