vll 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/vl +11 -0
- metadata +1 -1
data/bin/vl
CHANGED
@@ -18,6 +18,7 @@ $options = {
|
|
18
18
|
:justify => 'l',
|
19
19
|
:alternate_color => false,
|
20
20
|
:chop_length => 1024,
|
21
|
+
:max_n_cols => 200,
|
21
22
|
}
|
22
23
|
|
23
24
|
|
@@ -78,6 +79,10 @@ opts = OptionParser.new do |opts|
|
|
78
79
|
$options[:alternate_color] = c
|
79
80
|
end
|
80
81
|
|
82
|
+
opts.on('-m', '--max-num-cols <INT>', 'the maximum number of columns to show [200]') do |m|
|
83
|
+
$options[:max_n_cols] = m.to_i
|
84
|
+
end
|
85
|
+
|
81
86
|
opts.on('-l', '--chop-length <INT>', 'chop columns longer than this length [1024]') do |l|
|
82
87
|
$options[:chop_length] = l.to_i
|
83
88
|
end
|
@@ -134,6 +139,12 @@ def print_line(line, lnum)
|
|
134
139
|
# damn you, 'csv' package!
|
135
140
|
parsed_line = [] if parsed_line == nil
|
136
141
|
parsed_line.each_with_index do |c, i|
|
142
|
+
break if i > $options[:max_n_cols]
|
143
|
+
if i == $options[:max_n_cols] then
|
144
|
+
print "... #{parsed_line.size - i} more columns"
|
145
|
+
break
|
146
|
+
end
|
147
|
+
|
137
148
|
# damn you, 'csv' package!
|
138
149
|
c = '' if c == nil
|
139
150
|
c = c.inspect[1..-2]
|