Skip to content

Commit f524356

Browse files
csv-filter: add --output-row-sep (#331)
1 parent eec15de commit f524356

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
@@ -27,6 +27,11 @@ parser.on('--input-row-sep=SEPARATOR',
2727
options[:input_row_sep] = value
2828
end
2929

30+
parser.on('--output-row-sep=SEPARATOR',
31+
'Output row separator string.') do |value|
32+
options[:output_row_sep] = value
33+
end
34+
3035
begin
3136
parser.parse!
3237
rescue OptionParser::InvalidOption

test/csv/test_csv_filter.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,10 @@ def test_option_input_row_sep
8383
assert_equal(["aaa,bbb,ccc\nddd,eee,fff\n", ""],
8484
run_csv_filter(csv, "--input-row-sep=:"))
8585
end
86+
87+
def test_option_output_row_sep
88+
csv = "aaa,bbb,ccc\nddd,eee,fff\n"
89+
assert_equal(["aaa,bbb,ccc:ddd,eee,fff:", ""],
90+
run_csv_filter(csv, "--output-row-sep=:"))
91+
end
8692
end

0 commit comments

Comments
 (0)