ix-cli 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/ix-json-to-html-table-2 +52 -0
  3. metadata +10 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 943f1cbefd1b38913bd4291a440291b6997b9dce730e9990aacd8743f49ca24e
4
- data.tar.gz: dff95cf081a6d4b9f319fa5b86e97f3265cd115f72137dd6bef6b3ca1167da24
3
+ metadata.gz: d054eabc68581f7a85447e44ce7471bd3bfd361fec428cd6f52b07bc23d99f61
4
+ data.tar.gz: ef9b8158e1a5282d68956f9188f47d2e0753a7e42606b8fd48a8e684f2379d1a
5
5
  SHA512:
6
- metadata.gz: 523fa547597c6c94e3ba4b6b36dbb076ee5e199818ac72eb97d599c5a1043a0cad0bccd089b55457db447860cc476cb04e380d43d4e9b3fd88b3050ac428a583
7
- data.tar.gz: 93600db984ace082d9ba956228e7b543dd5766ac7da5cd4e66183009535a6000613399c1cb9bf082b7a4d34002dedbdcc0ef6b73bcd9d3c3e444d2a818dbbe22
6
+ metadata.gz: 312c40f4c85f2c8919ddaa1ea33a9306dfc2be0eecf51782d18abaaabf4a5d1cc8fd00507674081ecf5598e694d9c28f4c31783b7416afd11a6d86024b096904
7
+ data.tar.gz: 4f7d68947f74467984e028a8d66460d662b8a32d57cc2e0072bb63454b325b3ce7abaa7600ea02f7a8bf64b4e6c8355bb1a51d8b5be8c0b5bf3d095e11716cee
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'json'
5
+
6
+ def tag(name, content)
7
+ "<#{name}>#{content}</#{name}>"
8
+ end
9
+
10
+ def row(name, array)
11
+ array.map do |value|
12
+ tag(name, value)
13
+ end * ' '
14
+ end
15
+
16
+ table_header = false
17
+
18
+ puts '
19
+ <style>
20
+ tr:nth-child(even) {
21
+ background-color: whitesmoke;
22
+ }
23
+ th {
24
+ background: darkgray;
25
+ font-color: white;
26
+ padding: 1mm;
27
+ }
28
+ td {
29
+ padding: 1mm;
30
+ }
31
+ </style>
32
+ '
33
+
34
+ STDIN.each_line do |line|
35
+ begin
36
+ object = JSON.parse(line)
37
+ unless table_header
38
+ puts '<table>'
39
+ table_header_row = row('th', object.keys.sort)
40
+ puts tag('tr', table_header_row)
41
+ table_header = true
42
+ end
43
+ copy = object.keys.sort.map do |key|
44
+ object[key]
45
+ end
46
+ table_body_row = row('td', copy)
47
+ puts tag('tr', table_body_row)
48
+ rescue => error
49
+ end
50
+ end
51
+
52
+ puts '</table>'
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ix-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuyoshi Tlacaelel
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2020-02-05 00:00:00.000000000 Z
@@ -24,8 +24,8 @@ dependencies:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.0.4
27
- description:
28
- email:
27
+ description:
28
+ email:
29
29
  executables:
30
30
  - ix
31
31
  - ix-acronym
@@ -151,6 +151,7 @@ executables:
151
151
  - ix-json-to-csv
152
152
  - ix-json-to-dot
153
153
  - ix-json-to-html-table
154
+ - ix-json-to-html-table-2
154
155
  - ix-json-to-ruby-hash
155
156
  - ix-json-to-table
156
157
  - ix-json-to-table-2
@@ -431,6 +432,7 @@ files:
431
432
  - bin/ix-json-to-csv
432
433
  - bin/ix-json-to-dot
433
434
  - bin/ix-json-to-html-table
435
+ - bin/ix-json-to-html-table-2
434
436
  - bin/ix-json-to-ruby-hash
435
437
  - bin/ix-json-to-table
436
438
  - bin/ix-json-to-table-2
@@ -582,10 +584,10 @@ files:
582
584
  - bin/ix-wrap
583
585
  - bin/ix-xy
584
586
  - bin/ix-zebra
585
- homepage:
587
+ homepage:
586
588
  licenses: []
587
589
  metadata: {}
588
- post_install_message:
590
+ post_install_message:
589
591
  rdoc_options: []
590
592
  require_paths:
591
593
  - lib
@@ -600,8 +602,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
600
602
  - !ruby/object:Gem::Version
601
603
  version: '0'
602
604
  requirements: []
603
- rubygems_version: 3.1.2
604
- signing_key:
605
+ rubygems_version: 3.0.3
606
+ signing_key:
605
607
  specification_version: 4
606
608
  summary: ix - string manipulation tools
607
609
  test_files: []