diff --git a/bin/csv-filter b/bin/csv-filter index bfa26e12..f0e86137 100755 --- a/bin/csv-filter +++ b/bin/csv-filter @@ -27,6 +27,11 @@ parser.on('--input-row-sep=SEPARATOR', options[:input_row_sep] = value end +parser.on('--output-row-sep=SEPARATOR', + 'Output row separator string.') do |value| + options[:output_row_sep] = value +end + begin parser.parse! rescue OptionParser::InvalidOption diff --git a/test/csv/test_csv_filter.rb b/test/csv/test_csv_filter.rb index 95b82dbe..ad691921 100644 --- a/test/csv/test_csv_filter.rb +++ b/test/csv/test_csv_filter.rb @@ -83,4 +83,10 @@ def test_option_input_row_sep assert_equal(["aaa,bbb,ccc\nddd,eee,fff\n", ""], run_csv_filter(csv, "--input-row-sep=:")) end + + def test_option_output_row_sep + csv = "aaa,bbb,ccc\nddd,eee,fff\n" + assert_equal(["aaa,bbb,ccc:ddd,eee,fff:", ""], + run_csv_filter(csv, "--output-row-sep=:")) + end end