diff --git a/bin/csv-filter b/bin/csv-filter index 9dab8f4e..c5328171 100755 --- a/bin/csv-filter +++ b/bin/csv-filter @@ -16,6 +16,12 @@ Usage: #{parser.program_name} [options] and writes that text to the standard output. BANNER + +parser.on('--input-col-sep=SEPARATOR', + 'Input column separator string.') do |value| + options[:input_col_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 20fbe2af..01e39071 100644 --- a/test/csv/test_csv_filter.rb +++ b/test/csv/test_csv_filter.rb @@ -71,4 +71,10 @@ def test_option_v assert_equal(["csv-filter #{CSV::VERSION}\n", ""], run_csv_filter("", "-v")) end + + def test_option_input_col_sep + csv = "aaa:bbb:ccc\nddd:eee:fff\n" + assert_equal(["aaa,bbb,ccc\nddd,eee,fff\n", ""], + run_csv_filter(csv, "--input-col-sep=:")) + end end