Skip to content

Commit 559fbf7

Browse files
csv-filter: add --output-col-sep (#332)
1 parent f524356 commit 559fbf7

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-col-sep=SEPARATOR',
31+
'Output column separator string.') do |value|
32+
options[:output_col_sep] = value
33+
end
34+
3035
parser.on('--output-row-sep=SEPARATOR',
3136
'Output row separator string.') do |value|
3237
options[:output_row_sep] = value

test/csv/test_csv_filter.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ def test_option_input_row_sep
8484
run_csv_filter(csv, "--input-row-sep=:"))
8585
end
8686

87+
def test_option_output_col_sep
88+
csv = "aaa,bbb,ccc\nddd,eee,fff\n"
89+
assert_equal(["aaa:bbb:ccc\nddd:eee:fff\n", ""],
90+
run_csv_filter(csv, "--output-col-sep=:"))
91+
end
92+
8793
def test_option_output_row_sep
8894
csv = "aaa,bbb,ccc\nddd,eee,fff\n"
8995
assert_equal(["aaa,bbb,ccc:ddd,eee,fff:", ""],

0 commit comments

Comments
 (0)