Skip to content

Commit bfaa5fb

Browse files
Add option --input-col-sep to csv-filter (#329)
1 parent c457574 commit bfaa5fb

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

bin/csv-filter

+6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ Usage: #{parser.program_name} [options]
1616
and writes that text to the standard output.
1717
BANNER
1818

19+
20+
parser.on('--input-col-sep=SEPARATOR',
21+
'Input column separator string.') do |value|
22+
options[:input_col_sep] = value
23+
end
24+
1925
begin
2026
parser.parse!
2127
rescue OptionParser::InvalidOption

test/csv/test_csv_filter.rb

+6
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,10 @@ def test_option_v
7171
assert_equal(["csv-filter #{CSV::VERSION}\n", ""],
7272
run_csv_filter("", "-v"))
7373
end
74+
75+
def test_option_input_col_sep
76+
csv = "aaa:bbb:ccc\nddd:eee:fff\n"
77+
assert_equal(["aaa,bbb,ccc\nddd,eee,fff\n", ""],
78+
run_csv_filter(csv, "--input-col-sep=:"))
79+
end
7480
end

0 commit comments

Comments
 (0)