diff --git a/bin/csv-filter b/bin/csv-filter index f0e86137..8eddc538 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-col-sep=SEPARATOR', + 'Output column separator string.') do |value| + options[:output_col_sep] = value +end + parser.on('--output-row-sep=SEPARATOR', 'Output row separator string.') do |value| options[:output_row_sep] = value diff --git a/test/csv/test_csv_filter.rb b/test/csv/test_csv_filter.rb index ad691921..dc9f432a 100644 --- a/test/csv/test_csv_filter.rb +++ b/test/csv/test_csv_filter.rb @@ -84,6 +84,12 @@ def test_option_input_row_sep run_csv_filter(csv, "--input-row-sep=:")) end + def test_option_output_col_sep + csv = "aaa,bbb,ccc\nddd,eee,fff\n" + assert_equal(["aaa:bbb:ccc\nddd:eee:fff\n", ""], + run_csv_filter(csv, "--output-col-sep=:")) + end + def test_option_output_row_sep csv = "aaa,bbb,ccc\nddd,eee,fff\n" assert_equal(["aaa,bbb,ccc:ddd,eee,fff:", ""],