mdhost 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/VERSION +1 -1
- data/lib/mdhost.rb +25 -15
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbad6d4cf0eee94afaf0fb0d3b4b4de4daaefce726b93d6286f7d53b078c4d23
|
4
|
+
data.tar.gz: 2b2c6e7f473c8dc01e786ef247d44ab49b73e9bfc0d17d6ad420c5e5735ad8b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8db2ff43540427438950d1b1b3a1977b1774f86e44a9bad1cd1336d742dd44dd7c02de0d560a267e06e436ff9e5b02aaa4764467c9b71634d740f4b71cc15ec
|
7
|
+
data.tar.gz: 2a98c530ee577254a2e9c59f67e64e898fbbd258e3478a4519c19584ba2d77eb98e828c3037769063bee90a8a07b204bfdb0b85eb5771628ae0d21fca3e28c27
|
data/.rubocop.yml
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3
|
data/lib/mdhost.rb
CHANGED
@@ -25,18 +25,25 @@ 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
|
28
29
|
|
29
30
|
educate_on_error
|
30
31
|
end
|
31
32
|
|
32
33
|
if ARGV.empty?
|
33
|
-
Optimist
|
34
|
+
Optimist.educate
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
37
38
|
def run
|
38
|
-
|
39
|
-
|
39
|
+
@format_string = @options.format
|
40
|
+
|
41
|
+
if !@format_string && ARGV.length > 1
|
42
|
+
@format_string = FORMAT_SPECIFIER
|
43
|
+
end
|
44
|
+
|
45
|
+
if @format_string
|
46
|
+
Optimist.educate unless @format_string.include?(FORMAT_SPECIFIER)
|
40
47
|
run_format
|
41
48
|
else
|
42
49
|
@input = ARGV.first
|
@@ -81,9 +88,6 @@ module MDHost
|
|
81
88
|
display_table @input
|
82
89
|
|
83
90
|
escaped_input = escape_input @input
|
84
|
-
|
85
|
-
result = `eshost -e #{escaped_input}`.split(/\n+/)
|
86
|
-
|
87
91
|
table = results_for escaped_input
|
88
92
|
|
89
93
|
# We don't *need* to pretty format the table so precisely, but why not?
|
@@ -108,24 +112,30 @@ module MDHost
|
|
108
112
|
Clipboard.copy(output)
|
109
113
|
end
|
110
114
|
|
111
|
-
def
|
112
|
-
|
113
|
-
|
114
|
-
puts input
|
115
|
-
display_table input
|
116
|
-
end
|
115
|
+
def format(format_string, input)
|
116
|
+
format_string.sub(FORMAT_SPECIFIER, input)
|
117
|
+
end
|
117
118
|
|
119
|
+
def run_format
|
118
120
|
output = +<<~TABLE
|
119
121
|
|Input|JavaScriptCore|SpiderMonkey|V8
|
120
122
|
|-----|--------------|------------|--
|
121
123
|
TABLE
|
122
124
|
|
123
|
-
|
124
|
-
|
125
|
+
ARGV.each do |input|
|
126
|
+
formatted_input = format(@format_string, input)
|
127
|
+
|
128
|
+
puts formatted_input
|
129
|
+
display_table formatted_input
|
130
|
+
|
131
|
+
escaped_input = escape_input formatted_input
|
125
132
|
results = results_for escaped_input
|
126
133
|
|
134
|
+
display_input = @options.table_format ? format(@options.table_format, input)
|
135
|
+
: formatted_input
|
136
|
+
|
127
137
|
output << <<~ROW
|
128
|
-
|`#{
|
138
|
+
|`#{display_input}`|#{results[:JavaScriptCore]}|#{results[:SpiderMonkey]}|#{results[:V8]}
|
129
139
|
ROW
|
130
140
|
end
|
131
141
|
|
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.3'
|
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
|