Skip to content

Commit eec15de

Browse files
csv-filter: Add --input-row-sep (#330)
1 parent bfaa5fb commit eec15de

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

bin/csv-filter

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ parser.on('--input-col-sep=SEPARATOR',
2222
options[:input_col_sep] = value
2323
end
2424

25+
parser.on('--input-row-sep=SEPARATOR',
26+
'Input row separator string.') do |value|
27+
options[:input_row_sep] = value
28+
end
29+
2530
begin
2631
parser.parse!
2732
rescue OptionParser::InvalidOption

test/csv/test_csv_filter.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,10 @@ def test_option_input_col_sep
7777
assert_equal(["aaa,bbb,ccc\nddd,eee,fff\n", ""],
7878
run_csv_filter(csv, "--input-col-sep=:"))
7979
end
80+
81+
def test_option_input_row_sep
82+
csv = "aaa,bbb,ccc:ddd,eee,fff:"
83+
assert_equal(["aaa,bbb,ccc\nddd,eee,fff\n", ""],
84+
run_csv_filter(csv, "--input-row-sep=:"))
85+
end
8086
end

0 commit comments

Comments
 (0)