mdhost 0.2 → 0.4
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 +4 -4
- data/.rubocop.yml +4 -0
- data/VERSION +1 -1
- data/lib/mdhost.rb +30 -18
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a8134394649ff658a0481ef6c3e320f778e560154f4d07e873c3f56d28b1f77
|
4
|
+
data.tar.gz: 40438e7e07e3de5b341c05ee553f14d554329a51c8f688b2326ea63dabb4935d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60b49b4c61d662da9335cfd1413b7aedd99e90f624ae0424d99444f0e1a1acea3bf336d660c54fd3237cc9ba20c2b37ddfe98783df63c83a5baf2ac63e3a47da
|
7
|
+
data.tar.gz: 3c8ecc633e616d5c1863e2a3dceaac95a53c5a270fb51b3c13d8e9af65c29c6b9c9e138eb04da04e1b2834c577df9f55417a66f8fee68232632c2c3cbc2ec48a
|
data/.rubocop.yml
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4
|
data/lib/mdhost.rb
CHANGED
@@ -25,18 +25,27 @@ module MDHost
|
|
25
25
|
BANNER
|
26
26
|
|
27
27
|
opt :format, "Format string to compose multiple inputs into", type: :string
|
28
|
+
opt :table_format, 'Format string to use for the table "Input" column', type: :string
|
29
|
+
|
30
|
+
opt :browser_names, "Use browser names in output table"
|
28
31
|
|
29
32
|
educate_on_error
|
30
33
|
end
|
31
34
|
|
32
35
|
if ARGV.empty?
|
33
|
-
Optimist
|
36
|
+
Optimist.educate
|
34
37
|
end
|
35
38
|
end
|
36
39
|
|
37
40
|
def run
|
38
|
-
|
39
|
-
|
41
|
+
@format_string = @options.format
|
42
|
+
|
43
|
+
if !@format_string && ARGV.length > 1
|
44
|
+
@format_string = FORMAT_SPECIFIER
|
45
|
+
end
|
46
|
+
|
47
|
+
if @format_string
|
48
|
+
Optimist.educate unless @format_string.include?(FORMAT_SPECIFIER)
|
40
49
|
run_format
|
41
50
|
else
|
42
51
|
@input = ARGV.first
|
@@ -81,9 +90,6 @@ module MDHost
|
|
81
90
|
display_table @input
|
82
91
|
|
83
92
|
escaped_input = escape_input @input
|
84
|
-
|
85
|
-
result = `eshost -e #{escaped_input}`.split(/\n+/)
|
86
|
-
|
87
93
|
table = results_for escaped_input
|
88
94
|
|
89
95
|
# We don't *need* to pretty format the table so precisely, but why not?
|
@@ -108,24 +114,30 @@ module MDHost
|
|
108
114
|
Clipboard.copy(output)
|
109
115
|
end
|
110
116
|
|
117
|
+
def format(format_string, input)
|
118
|
+
format_string.sub(FORMAT_SPECIFIER, input)
|
119
|
+
end
|
120
|
+
|
111
121
|
def run_format
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
122
|
+
output = +"|Input|"
|
123
|
+
output += @options.browser_names ? "Safari|Firefox|Chrome"
|
124
|
+
: "JavaScriptCore|SpiderMonkey|V8"
|
125
|
+
output += "\n|---|---|---|---\n"
|
126
|
+
|
127
|
+
ARGV.each do |input|
|
128
|
+
formatted_input = format(@format_string, input)
|
117
129
|
|
118
|
-
|
119
|
-
|
120
|
-
|-----|--------------|------------|--
|
121
|
-
TABLE
|
130
|
+
puts formatted_input
|
131
|
+
display_table formatted_input
|
122
132
|
|
123
|
-
|
124
|
-
escaped_input = escape_input input
|
133
|
+
escaped_input = escape_input formatted_input
|
125
134
|
results = results_for escaped_input
|
126
135
|
|
136
|
+
display_input = @options.table_format ? format(@options.table_format, input)
|
137
|
+
: formatted_input
|
138
|
+
|
127
139
|
output << <<~ROW
|
128
|
-
|`#{
|
140
|
+
|`#{display_input}`|#{results[:JavaScriptCore]}|#{results[:SpiderMonkey]}|#{results[:V8]}
|
129
141
|
ROW
|
130
142
|
end
|
131
143
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mdhost
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vinny Diehl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clipboard
|
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
90
|
- !ruby/object:Gem::Version
|
91
91
|
version: '0'
|
92
92
|
requirements: []
|
93
|
-
rubygems_version: 3.4.
|
93
|
+
rubygems_version: 3.4.22
|
94
94
|
signing_key:
|
95
95
|
specification_version: 4
|
96
96
|
summary: Generate Markdown eshost tables
|