ix-cli 0.0.22 → 0.0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/ix-json-to-table +75 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94b8eb446a54c5056c89bd165ab2ad95d8a467505411bb04e754fb9e21b9f8fa
|
4
|
+
data.tar.gz: a5f13c650d9a71f445004095caa015525890d04fd99a4779ad62192da9d61a85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50abf08438d6c0ffe45edff3d63bca4cc67e732d854239c942bff4f8c4bef421e0194a15e79b1164da522693e19a685ed610edf65e72b187d7eae065e135168e
|
7
|
+
data.tar.gz: 6f9e372f9346c9e6f64fea0d8db771f770e102b38fc20e565b9055a62b0e470e1d3e5685eabad03fd0610dcc3802db48dc87419c6eb285ad5081c96009dc6eb1
|
data/bin/ix-json-to-table
CHANGED
@@ -8,6 +8,7 @@ options = {}
|
|
8
8
|
options[:orient] = 'top'
|
9
9
|
options[:transpose] = false
|
10
10
|
options[:adjust] = false
|
11
|
+
options[:skin] = 'round'
|
11
12
|
|
12
13
|
OptionParser.new do |opts|
|
13
14
|
|
@@ -29,6 +30,14 @@ OptionParser.new do |opts|
|
|
29
30
|
options[:adjust] = value
|
30
31
|
end
|
31
32
|
|
33
|
+
opts.on('-i', '--skin [NAME]', 'Change the skin, can be: [round, square, none, ascii, double].') do |value|
|
34
|
+
options[:skin] = value
|
35
|
+
end
|
36
|
+
|
37
|
+
opts.on('-c', '--count', 'Count, weather if you want a total count of items to be added at the end.') do |value|
|
38
|
+
options[:count] = value
|
39
|
+
end
|
40
|
+
|
32
41
|
end.parse!
|
33
42
|
|
34
43
|
required_options = [:orient]
|
@@ -49,7 +58,9 @@ def print_table(data, options)
|
|
49
58
|
end
|
50
59
|
end
|
51
60
|
|
52
|
-
|
61
|
+
skin = {}
|
62
|
+
|
63
|
+
skin['round'] = {
|
53
64
|
:top_left => '╭',
|
54
65
|
:top_right => '╮',
|
55
66
|
:bottom_left => '╰',
|
@@ -63,6 +74,64 @@ def print_table(data, options)
|
|
63
74
|
:right => '┤'
|
64
75
|
}
|
65
76
|
|
77
|
+
skin['none'] = {
|
78
|
+
:top_left => ' ',
|
79
|
+
:top_right => ' ',
|
80
|
+
:bottom_left => ' ',
|
81
|
+
:bottom_right => ' ',
|
82
|
+
:vertical => ' ',
|
83
|
+
:horizontal => ' ',
|
84
|
+
:cross => ' ',
|
85
|
+
:top => ' ',
|
86
|
+
:bottom => ' ',
|
87
|
+
:left => ' ',
|
88
|
+
:right => ' '
|
89
|
+
}
|
90
|
+
|
91
|
+
skin['ascii'] = {
|
92
|
+
:top_left => '+',
|
93
|
+
:top_right => '+',
|
94
|
+
:bottom_left => '+',
|
95
|
+
:bottom_right => '+',
|
96
|
+
:vertical => '|',
|
97
|
+
:horizontal => '-',
|
98
|
+
:cross => '+',
|
99
|
+
:top => '+',
|
100
|
+
:bottom => '+',
|
101
|
+
:left => '+',
|
102
|
+
:right => '+'
|
103
|
+
}
|
104
|
+
|
105
|
+
skin['square'] = {
|
106
|
+
:top_left => '┌',
|
107
|
+
:top_right => '┐',
|
108
|
+
:bottom_left => '└',
|
109
|
+
:bottom_right => '┘',
|
110
|
+
:vertical => '│',
|
111
|
+
:horizontal => '─',
|
112
|
+
:cross => '┼',
|
113
|
+
:top => '┬',
|
114
|
+
:bottom => '┴',
|
115
|
+
:left => '├',
|
116
|
+
:right => '┤'
|
117
|
+
}
|
118
|
+
|
119
|
+
skin['double'] = {
|
120
|
+
:top_left => '╔',
|
121
|
+
:top_right => '╗',
|
122
|
+
:bottom_left => '╚',
|
123
|
+
:bottom_right => '╝',
|
124
|
+
:vertical => '║',
|
125
|
+
:horizontal => '═',
|
126
|
+
:cross => '╬',
|
127
|
+
:top => '╦',
|
128
|
+
:bottom => '╩',
|
129
|
+
:left => '╠',
|
130
|
+
:right => '╣'
|
131
|
+
}
|
132
|
+
|
133
|
+
config = skin[options[:skin]]
|
134
|
+
|
66
135
|
cm = columns.keys.sort.map do |key|
|
67
136
|
s = ''
|
68
137
|
value = columns[key]
|
@@ -101,9 +170,13 @@ def print_table(data, options)
|
|
101
170
|
puts middle_ruler
|
102
171
|
puts headers
|
103
172
|
end
|
173
|
+
|
104
174
|
puts bottom_ruler
|
105
175
|
|
106
|
-
|
176
|
+
if options[:count]
|
177
|
+
puts "Total: #{data.size} rows"
|
178
|
+
end
|
179
|
+
|
107
180
|
end
|
108
181
|
|
109
182
|
def transpose(hash)
|