remoji 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +18 -6
  3. data/lib/remoji.rb +15 -6
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a441727a45e79e3f715fa13f85330987a37124dd138a4a6d4c4c76cbeed653a
4
- data.tar.gz: c6a61415b889ede140277fb80ef6a1d7b8c530f3861b1125058a79b1f61799e0
3
+ metadata.gz: 0db00a5c5df74f3eff3620d9565583aa35496af50e3cb15fc905fed2d1540e9e
4
+ data.tar.gz: aca36f3aef6e395accede18438eba7525fa0d20d9149234dc98aa30c36ae06df
5
5
  SHA512:
6
- metadata.gz: 8138590af2b810fafa43ad81c90b5c37e5480772ead462df091a412fd8f845bbf8a7930499628eb48e856eba4bd1bea469e466bcf91197782f75dc5d6c2e19e0
7
- data.tar.gz: 7d5be1dabee1bc4766813a2cf3b6529bb48aac69aa21ab5f65733b22146683cb977e8a5f222f239fe5b194894fdac815a5f89fc7aef18cc9ee75a0eafdb29d8e
6
+ metadata.gz: ee555c22990008b8fa4d6058d055f46d3fc2753ac740b3f7396c20221f77c5175c430990a0f131b0cff7a20a8b3cfbadefa40117c61c3bfc5cc9175a2fde2b41
7
+ data.tar.gz: 1f9e3c9619bcb0844f20694d2e250a80ad49f53645b28806f396b9f8fc69ba68179013ef331c3fd63d476e2302b62c8a14aec4f28359d6eef7c662da01324705
data/README.adoc CHANGED
@@ -33,12 +33,8 @@ Normal List
33
33
 
34
34
  ----
35
35
  % emj -c Animal cat
36
- {
37
- :"cat face" => "🐱"
38
- }
39
- {
40
- :cat => "🐈"
41
- }
36
+ cat face: 🐱
37
+ cat: 🐈
42
38
  ----
43
39
 
44
40
  Without any metadata
@@ -47,3 +43,19 @@ Without any metadata
47
43
  % emj -n -c Animal cat
48
44
  🐱 🐈
49
45
  ----
46
+
47
+ Show all categories / subcategories
48
+
49
+ ----
50
+ % emj --cats
51
+ % emj --subs
52
+ ----
53
+
54
+ Show all emojis in the subcategory 'monkey-face' with lots of verbose data.
55
+
56
+ ----
57
+ % emj -s monkey-face
58
+ see-no-evil monkey: {:code=>"U+1F648", :sym=>"🙈", :cat=>"Smileys & Emotion", :subcat=>"monkey-face"}
59
+ hear-no-evil monkey: {:code=>"U+1F649", :sym=>"🙉", :cat=>"Smileys & Emotion", :subcat=>"monkey-face"}
60
+ speak-no-evil monkey: {:code=>"U+1F64A", :sym=>"🙊", :cat=>"Smileys & Emotion", :subcat=>"monkey-face"}
61
+ ----
data/lib/remoji.rb CHANGED
@@ -4,7 +4,6 @@ require 'pathname'
4
4
  require 'optparse'
5
5
  require 'ostruct'
6
6
  require 'json'
7
- require 'awesome_print'
8
7
  require 'pry'
9
8
  require 'nokogiri'
10
9
  require 'open-uri'
@@ -65,7 +64,7 @@ class Remoji
65
64
  end
66
65
 
67
66
  def initialize
68
- @options = OpenStruct.new
67
+ @options = OpenStruct.new verbose: 0
69
68
  verify_cache!
70
69
  end
71
70
 
@@ -123,7 +122,7 @@ class Remoji
123
122
  OptionParser.new do |o|
124
123
  o.banner = "#{$PROGRAM_NAME} [options] EMOJI ANOTHER_EMOJI ..."
125
124
  o.separator 'Where EMOJI is an emoji name to search for'
126
- %i[cat subcat details cats subcats].each do |sym|
125
+ %i[cat subcat details cats subcats verbose].each do |sym|
127
126
  send "#{sym}_opt".to_sym, o
128
127
  end
129
128
  o.on('-h', '--help') do
@@ -133,15 +132,19 @@ class Remoji
133
132
  end.parse!(args)
134
133
  end
135
134
 
135
+ def verbose_opt(opt)
136
+ opt.on('-v', '--verbose', 'Increase verbosity') { @options.verbose += 1 }
137
+ end
138
+
136
139
  def cats_opt(opt)
137
- opt.on('--subs', '--subcategories') do
140
+ opt.on('--subs', '--subcategories', 'List subcategories') do
138
141
  ap subcategories
139
142
  exit
140
143
  end
141
144
  end
142
145
 
143
146
  def subcats_opt(opt)
144
- opt.on('--cats', '--categories') do
147
+ opt.on('--cats', '--categories', 'List Categories') do
145
148
  ap categories
146
149
  exit
147
150
  end
@@ -163,7 +166,13 @@ class Remoji
163
166
  if options.no
164
167
  puts them.map { |_k, v| v[:sym] }.join(' ')
165
168
  else
166
- them.each { |k, v| ap(k => v[:sym]) }
169
+ them.each do |k, v|
170
+ if options.verbose.positive?
171
+ puts "#{k}: #{v}"
172
+ else
173
+ puts "#{k}: #{v[:sym]}"
174
+ end
175
+ end
167
176
  end
168
177
  end
169
178
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remoji
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - tj@rubyists.com