vll 0.0.9 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/vl +38 -36
- metadata +23 -11
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 45f591ee31b7f6aae75b6a7e93167acb74d24bf8
|
4
|
+
data.tar.gz: b68d5beb4e20c16f03fca100d2bbf3617b1f39f5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f02f3686a066d312491ce4da5941522b040109245009f572b52a5dd19ba911c41393b96c3b832ef3c1044f6ea394578e9bf4242b107987abbf418a27bdfb3571
|
7
|
+
data.tar.gz: b6851e032809470efb60232278c2ae797bbb7c3fa392dd3b05a137f5e4665f08265b5ea81767c3bba1b3a2bd145e7d52684038acca4a9b50e6dee6f1ad90cdbe
|
data/bin/vl
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
begin
|
3
3
|
|
4
4
|
require 'optparse'
|
5
|
+
require 'colorize'
|
5
6
|
require 'csv'
|
6
7
|
|
7
8
|
$options = {
|
@@ -12,31 +13,25 @@ $options = {
|
|
12
13
|
:justify => 'l',
|
13
14
|
}
|
14
15
|
|
15
|
-
if ARGF.filename =~ /.*\.csv/
|
16
|
-
$options[:separator] = ','
|
17
|
-
$options[:quote] = '"'
|
18
|
-
else
|
19
|
-
$options[:separator] = "\t"
|
20
|
-
$options[:quote] = "\x00"
|
21
|
-
end
|
22
16
|
|
23
17
|
|
24
18
|
opts = OptionParser.new do |opts|
|
25
19
|
opts.program_name = '(V)iew (L)arge table'
|
26
20
|
opts.version = '20150113'
|
21
|
+
opts.set_summary_indent ' '
|
22
|
+
opts.set_summary_width 25
|
27
23
|
|
28
|
-
opts.banner = '(V)iew (L)arge table: lightning fast table formatter'
|
29
24
|
opts.separator ''
|
30
|
-
opts.separator '
|
31
|
-
opts.separator '
|
32
|
-
opts.separator '
|
33
|
-
opts.separator ' vll FILENAME [options]'
|
25
|
+
opts.separator '/==============================================================================\\'
|
26
|
+
opts.separator ''
|
27
|
+
opts.separator ' (' + 'V'.bold.blue + ')iew (' + 'L'.bold.yellow + ')arge table: lightning fast table formatter'
|
34
28
|
opts.separator ''
|
35
|
-
opts.separator '
|
29
|
+
opts.separator ' output to stdout: ' + 'vl FILENAME [options]'.green
|
30
|
+
opts.separator ' pipe to less: ' + 'vll FILENAME [options]'.green
|
31
|
+
opts.separator ''
|
32
|
+
opts.separator ' Options:'
|
36
33
|
|
37
|
-
opts.on('-s', '--separator [
|
38
|
-
'char or string to match the separator',
|
39
|
-
' default: "," (if csv, "\t")') do |s|
|
34
|
+
opts.on('-s', '--separator <REGEX>', 'char or string to match the separator [\t]') do |s|
|
40
35
|
begin
|
41
36
|
options[:separator] = Regexp.new(s)
|
42
37
|
rescue
|
@@ -45,29 +40,19 @@ opts = OptionParser.new do |opts|
|
|
45
40
|
end
|
46
41
|
end
|
47
42
|
|
48
|
-
opts.on('-p', '--padding [
|
49
|
-
'number of spaces that separate the columns',
|
50
|
-
' default: 1') do |p|
|
43
|
+
opts.on('-p', '--padding <INT>', 'number of spaces that separate the columns [1]') do |p|
|
51
44
|
$options[:padding] = p.to_i
|
52
45
|
end
|
53
46
|
|
54
|
-
opts.on('-k', '--skip [
|
55
|
-
'number of top lines to skip',
|
56
|
-
' default: 0') do |k|
|
47
|
+
opts.on('-k', '--skip <INT>', 'number of top lines to skip [0]') do |k|
|
57
48
|
$options[:skip] = k.to_i
|
58
49
|
end
|
59
50
|
|
60
|
-
opts.on('-p', '--probe-lines [
|
61
|
-
'number of top lines used for fast estimation',
|
62
|
-
' default: 100') do |p|
|
51
|
+
opts.on('-p', '--probe-lines <INT>', 'number of top lines used for estimation [100]') do |p|
|
63
52
|
$options[:probe_lines] = p.to_i
|
64
53
|
end
|
65
54
|
|
66
|
-
opts.on('-j', '--justify [
|
67
|
-
'justification mode for cells',
|
68
|
-
' auto will only right-justify numbers',
|
69
|
-
' options: l = left, r = right, a = auto',
|
70
|
-
' default: l') do |j|
|
55
|
+
opts.on('-j', '--justify {l|r|a}', 'justification mode for cells (l/r/a) [l]') do |j|
|
71
56
|
if ['l', 'r', 'a'].include?(j[0])
|
72
57
|
$options[:justify] = j[0]
|
73
58
|
else
|
@@ -76,9 +61,7 @@ opts = OptionParser.new do |opts|
|
|
76
61
|
end
|
77
62
|
end
|
78
63
|
|
79
|
-
opts.on('-c', '--comment [
|
80
|
-
'regex to match lines to ignore',
|
81
|
-
' default: ^#') do |c|
|
64
|
+
opts.on('-c', '--comment <REGEX>', 'regex to match lines to ignore [^#]') do |c|
|
82
65
|
begin
|
83
66
|
$options[:comment] = Regexp.new(c)
|
84
67
|
rescue
|
@@ -87,16 +70,35 @@ opts = OptionParser.new do |opts|
|
|
87
70
|
end
|
88
71
|
end
|
89
72
|
|
90
|
-
opts.on('-q', '--quote [
|
91
|
-
'character of quote',
|
92
|
-
' default: \x00') do |q|
|
73
|
+
opts.on('-q', '--quote <CHAR>', 'character of quote [\x00]') do |q|
|
93
74
|
$options[:quote] = q
|
94
75
|
end
|
76
|
+
|
77
|
+
opts.separator ''
|
78
|
+
opts.separator '\==============================================================================/'
|
79
|
+
opts.separator ''
|
95
80
|
end
|
96
81
|
|
97
82
|
opts.parse!
|
98
83
|
|
99
84
|
|
85
|
+
if !$options[:separator]
|
86
|
+
if ARGF.filename =~ /.*\.csv/
|
87
|
+
$options[:separator] = ','
|
88
|
+
else
|
89
|
+
$options[:separator] = "\t"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
if !$options[:quote]
|
94
|
+
if ARGF.filename =~ /.*\.csv/
|
95
|
+
$options[:quote] = '"'
|
96
|
+
else
|
97
|
+
$options[:quote] = "\x00"
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
|
100
102
|
#------#
|
101
103
|
# Main #
|
102
104
|
#------#
|
metadata
CHANGED
@@ -1,16 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.0.9
|
4
|
+
version: 0.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- xzhu
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2015-07-
|
13
|
-
dependencies:
|
11
|
+
date: 2015-07-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: colorize
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.7.7
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.7.7
|
14
27
|
description: Nicely format columns of a large CSV/TSV file according to their content
|
15
28
|
width, using first few lines as estimation thus extremely fast. Customizable.
|
16
29
|
email:
|
@@ -26,26 +39,25 @@ files:
|
|
26
39
|
homepage:
|
27
40
|
licenses:
|
28
41
|
- MIT
|
42
|
+
metadata: {}
|
29
43
|
post_install_message:
|
30
44
|
rdoc_options: []
|
31
45
|
require_paths:
|
32
46
|
- lib
|
33
47
|
required_ruby_version: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
48
|
requirements:
|
36
|
-
- -
|
49
|
+
- - ">="
|
37
50
|
- !ruby/object:Gem::Version
|
38
51
|
version: '0'
|
39
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
53
|
requirements:
|
42
|
-
- -
|
54
|
+
- - ">="
|
43
55
|
- !ruby/object:Gem::Version
|
44
56
|
version: '0'
|
45
57
|
requirements: []
|
46
58
|
rubyforge_project:
|
47
|
-
rubygems_version:
|
59
|
+
rubygems_version: 2.4.5
|
48
60
|
signing_key:
|
49
|
-
specification_version:
|
50
|
-
summary: (V)iew (L)arge table. Format large table in a split of a second
|
61
|
+
specification_version: 4
|
62
|
+
summary: "(V)iew (L)arge table. Format large table in a split of a second"
|
51
63
|
test_files: []
|