vll 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/vl +3 -17
- metadata +1 -1
data/bin/vl
CHANGED
@@ -36,13 +36,8 @@ opts = OptionParser.new do |opts|
|
|
36
36
|
opts.separator ''
|
37
37
|
opts.separator ' Options:'
|
38
38
|
|
39
|
-
opts.on('-s', '--separator <REGEX>', 'char or string to match the separator [
|
40
|
-
|
41
|
-
options[:separator] = Regexp.new(s)
|
42
|
-
rescue
|
43
|
-
puts 'Warning: Problems encountered when processing the regex.'
|
44
|
-
puts "Warning: Default value \"#{$options[:separator].source}\" is used."
|
45
|
-
end
|
39
|
+
opts.on('-s', '--separator <REGEX>', 'char or string to match the separator [auto]') do |s|
|
40
|
+
$options[:separator] = s
|
46
41
|
end
|
47
42
|
|
48
43
|
opts.on('-p', '--padding <INT>', 'number of spaces that separate the columns [1]') do |p|
|
@@ -75,7 +70,7 @@ opts = OptionParser.new do |opts|
|
|
75
70
|
end
|
76
71
|
end
|
77
72
|
|
78
|
-
opts.on('-q', '--quote <CHAR>', 'character of quote [
|
73
|
+
opts.on('-q', '--quote <CHAR>', 'character of quote ["]') do |q|
|
79
74
|
$options[:quote] = q
|
80
75
|
end
|
81
76
|
|
@@ -103,15 +98,6 @@ if !$options[:separator]
|
|
103
98
|
end
|
104
99
|
end
|
105
100
|
|
106
|
-
if !$options[:quote]
|
107
|
-
if ARGF.filename =~ /.*\.csv/
|
108
|
-
$options[:quote] = '"'
|
109
|
-
else
|
110
|
-
$options[:quote] = "\x00"
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
|
115
101
|
#------#
|
116
102
|
# Main #
|
117
103
|
#------#
|