Sha256: 626ad614fb676571261783e236665099c5a58dfcbcc5248a0d6d22809fc307af

Contents?: true

Size: 680 Bytes

Versions: 1

Compression:

Stored size: 680 Bytes

Contents

#!/usr/bin/env ruby

unless ARGV.size == 1
  abort <<-D
usage: emoji name
       emoji -l
  D
end 

require 'named_emoji'

case ARGV[0]
when '-l'
  max_name_size = NamedEmoji.emojis.keys.map {|i| i.size}.max
  %w(PEOPLE NATURE OBJECTS PLACES SYMBOLS).each do |category|
    puts category + ":"
    puts
    emojis = NamedEmoji.const_get(category.upcase)
    emojis.keys.each_slice(4) do |keys|
      keys.each do |key|
        value = emojis[key]
        print "#{value ? value : '  '}  #{key.to_s.ljust(max_name_size)}"
      end
      puts
    end
    puts
  end
else
  if emoji = NamedEmoji.emojis[ARGV[0].to_sym]
    print emoji
  else
    warn "Emoji not found :("
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
named_emoji-1.1.1 bin/emoji