Add alias l for line and alias ls for lins as a trial (#17)

This commit is contained in:
kojix2 2023-01-05 10:53:13 +09:00
parent 85ed440c52
commit 1f41e79952
3 changed files with 16 additions and 4 deletions

View File

@ -178,9 +178,9 @@ module YouPlot
@backend.barplot(data, params, count: true, reverse: options[:reverse])
when :hist, :histogram
@backend.histogram(data, params)
when :line, :lineplot
when :line, :lineplot, :l
@backend.line(data, params, options[:fmt])
when :lines, :lineplots
when :lines, :lineplots, :ls
@backend.lines(data, params, options[:fmt])
when :scatter, :s
@backend.scatter(data, params, options[:fmt])

View File

@ -291,14 +291,14 @@ module YouPlot
params.nbins = v
end
when :lineplot, :line
when :lineplot, :line, :l
sub_parser_add_canvas
sub_parser_add_grid
sub_parser_add_fmt_yx
sub_parser_add_ylim
sub_parser_add_xlim
when :lineplots, :lines
when :lineplots, :lines, :ls
sub_parser_add_canvas
sub_parser_add_grid
sub_parser_add_fmt_xyxy

View File

@ -69,6 +69,12 @@ class YouPlotIRISTest < Test::Unit::TestCase
assert_equal fixture('iris-lineplot.txt'), @stderr_file.read
end
# l is an undocumented alias of lineplot.
test :l do
YouPlot::Command.new(['l', '-H', '-d,', '-t', 'IRIS-LINEPLOT']).run
assert_equal fixture('iris-lineplot.txt'), @stderr_file.read
end
test :lineplots do
YouPlot::Command.new(['lineplots', '-H', '-d,', '-t', 'IRIS-LINEPLOTS']).run
assert_equal fixture('iris-lineplots.txt'), @stderr_file.read
@ -79,6 +85,12 @@ class YouPlotIRISTest < Test::Unit::TestCase
assert_equal fixture('iris-lineplots.txt'), @stderr_file.read
end
# ls is an undocumented alias of lineplots.
test :ls do
YouPlot::Command.new(['lines', '-H', '-d,', '-t', 'IRIS-LINEPLOTS']).run
assert_equal fixture('iris-lineplots.txt'), @stderr_file.read
end
test :scatter do
YouPlot::Command.new(['scatter', '-H', '-d,', '-t', 'IRIS-SCATTER']).run
assert_equal fixture('iris-scatter.txt'), @stderr_file.read