remoji 0.0.7 โ 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +25 -2
- data/lib/remoji.rb +30 -9
- 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: c75476c47ca7b6c763454e478fd9799bce7c53faf3e07dbb918b6dcfe2f7cfb6
|
4
|
+
data.tar.gz: 48f4c44378c1c6974bc65e337b9fa375d68c3f11b70ca9009937aeefa80acfeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aaf22d4a603b6e68c3ddc65e34b585cc04046999ffd73c7f4d91389d926434bab57b99a1bdc1a88988144aefa621678f64b29d7f541e4fab72174563a28f46de
|
7
|
+
data.tar.gz: bee77b6c23833062797fb0d63d9160755cd5e7c81f8e427722e4011b166ba6a168b5ede7b734cf396ea563de236d37e20c76f0d79297325b2867c6c4840761e5
|
data/README.adoc
CHANGED
@@ -29,7 +29,7 @@ Where EMOJI is an emoji name to search for
|
|
29
29
|
|
30
30
|
== Examples
|
31
31
|
|
32
|
-
Normal List
|
32
|
+
Normal List, searching the main category 'Animal' for 'cat'
|
33
33
|
|
34
34
|
----
|
35
35
|
% emj -c Animal cat
|
@@ -37,7 +37,7 @@ cat face: ๐ฑ
|
|
37
37
|
cat: ๐
|
38
38
|
----
|
39
39
|
|
40
|
-
Without any metadata
|
40
|
+
Without any metadata (-n)
|
41
41
|
|
42
42
|
----
|
43
43
|
% emj -n -c Animal cat
|
@@ -59,3 +59,26 @@ see-no-evil monkey: {:code=>"U+1F648", :sym=>"๐", :cat=>"Smileys & Emotion",
|
|
59
59
|
hear-no-evil monkey: {:code=>"U+1F649", :sym=>"๐", :cat=>"Smileys & Emotion", :subcat=>"monkey-face"}
|
60
60
|
speak-no-evil monkey: {:code=>"U+1F64A", :sym=>"๐", :cat=>"Smileys & Emotion", :subcat=>"monkey-face"}
|
61
61
|
----
|
62
|
+
|
63
|
+
Show all emojis in the 'household' subcategory
|
64
|
+
|
65
|
+
----
|
66
|
+
% emj -s household
|
67
|
+
door: ๐ช
|
68
|
+
bed: ๐
|
69
|
+
couch and lamp: ๐
|
70
|
+
chair: ๐ช
|
71
|
+
toilet: ๐ฝ
|
72
|
+
shower: ๐ฟ
|
73
|
+
bathtub: ๐
|
74
|
+
razor: ๐ช
|
75
|
+
lotion bottle: ๐งด
|
76
|
+
safety pin: ๐งท
|
77
|
+
broom: ๐งน
|
78
|
+
basket: ๐งบ
|
79
|
+
roll of paper: ๐งป
|
80
|
+
soap: ๐งผ
|
81
|
+
sponge: ๐งฝ
|
82
|
+
fire extinguisher: ๐งฏ
|
83
|
+
shopping cart: ๐
|
84
|
+
----
|
data/lib/remoji.rb
CHANGED
@@ -10,7 +10,7 @@ require 'open-uri'
|
|
10
10
|
require 'awesome_print'
|
11
11
|
|
12
12
|
# The Remoji command
|
13
|
-
class Remoji
|
13
|
+
class Remoji # rubocop:disable Metrics/ClassLength
|
14
14
|
EMOJI_TABLE = 'http://unicode.org/emoji/charts/full-emoji-list.html'.freeze
|
15
15
|
|
16
16
|
def self.run!(args)
|
@@ -107,23 +107,36 @@ class Remoji
|
|
107
107
|
parse_opts! args
|
108
108
|
|
109
109
|
if args.empty?
|
110
|
-
output filter_hash
|
110
|
+
output filter_hash
|
111
111
|
exit
|
112
112
|
end
|
113
113
|
|
114
114
|
found = {}
|
115
|
-
args.each do |
|
116
|
-
found.merge!(
|
115
|
+
args.each do |arg|
|
116
|
+
found.merge!(find_in_filter_hash(arg))
|
117
117
|
end
|
118
118
|
|
119
|
-
output found
|
119
|
+
output found
|
120
|
+
end
|
121
|
+
|
122
|
+
def find_in_filter_hash(arg)
|
123
|
+
filter_hash.select do |k, _v|
|
124
|
+
s = k.to_s
|
125
|
+
if @options.exact
|
126
|
+
s == arg
|
127
|
+
elsif @options.regex
|
128
|
+
s =~ /#{arg}/
|
129
|
+
else
|
130
|
+
s =~ /#{arg}/i
|
131
|
+
end
|
132
|
+
end
|
120
133
|
end
|
121
134
|
|
122
135
|
def parse_opts!(args)
|
123
136
|
OptionParser.new do |o|
|
124
137
|
o.banner = "#{$PROGRAM_NAME} [options] EMOJI ANOTHER_EMOJI ..."
|
125
138
|
o.separator 'Where EMOJI is an emoji name to search for'
|
126
|
-
%i[cat subcat details cats subcats verbose].each do |sym|
|
139
|
+
%i[cat subcat details cats subcats verbose exact regex].each do |sym|
|
127
140
|
send "#{sym}_opt".to_sym, o
|
128
141
|
end
|
129
142
|
o.on('-h', '--help') do
|
@@ -133,6 +146,14 @@ class Remoji
|
|
133
146
|
end.parse!(args)
|
134
147
|
end
|
135
148
|
|
149
|
+
def exact_opt(opt)
|
150
|
+
opt.on('-e', '--exact', 'Exactly match the emoji given, do not search for it') { @options.exact = true }
|
151
|
+
end
|
152
|
+
|
153
|
+
def regex_opt(opt)
|
154
|
+
opt.on('-r', '--regex', 'Consider each argument a regular expressoin') { @options.regex = true }
|
155
|
+
end
|
156
|
+
|
136
157
|
def verbose_opt(opt)
|
137
158
|
opt.on('-v', '--verbose', 'Increase verbosity') { @options.verbose += 1 }
|
138
159
|
end
|
@@ -163,12 +184,12 @@ class Remoji
|
|
163
184
|
opt.on('-n', '--no-details', 'Just print the emojis') { |_| @options.no = true }
|
164
185
|
end
|
165
186
|
|
166
|
-
def output(them
|
167
|
-
if options.no
|
187
|
+
def output(them)
|
188
|
+
if @options.no
|
168
189
|
puts them.map { |_k, v| v[:sym] }.join(' ')
|
169
190
|
else
|
170
191
|
them.each do |k, v|
|
171
|
-
if options.verbose.positive?
|
192
|
+
if @options.verbose.positive?
|
172
193
|
puts "#{k}: #{v}"
|
173
194
|
else
|
174
195
|
puts "#{k}: #{v[:sym]}"
|