emspect v1.1.1
๐งโ๏ธ๐ฒ๐ ฟ๏ธ๐งยฉ๏ธ๐ - EMSPECT
Emspect is a CLI utility to search emojis and inspect details of the character. It works on Node.js and can be also used as Node.js library so you can embed its features to your cool applications. "Emspect" stands for EMoji inSPECTor.
Examples
$ emspect sleep
๐ช SLEEPY FACE (U+1F62A) - face, person, sleep :sleepy:
๐ด SLEEPING FACE (U+1F634) - face, person, sleep, zzz :sleeping:
๐ค SLEEPING SYMBOL โ zzz (U+1F4A4) - comic, emotion, person, sleep, symbol, word, zzz :zzz:
๐ SLEEPING ACCOMMODATION โ person in bed (U+1F6CC) - hotel, object, sleep
๐ BED (U+1F6CF) - bed, hotel, object, sleep
$ emspect sleep --format all # verbose
U+1F62A ๐ช SLEEPY FACE 2010สฒ emoji face, person, sleep :sleepy:
U+1F634 ๐ด SLEEPING FACE 2012หฃ emoji face, person, sleep, zzz :sleeping:
U+1F4A4 ๐ค SLEEPING SYMBOL zzz 2010สฒ emoji comic, emotion, person, sleep, symbol, word, zzz :zzz:
U+1F6CC ๐ SLEEPING ACCOMMODATION person in bed 2014หฃ emoji hotel, object, sleep
U+1F6CF ๐ BED 2014สท text bed, hotel, object, sleep
$ emspect U+1F62A --format json # Can search from character code. Also output in JSON
[{"code":"U+1F62A","chars":"๐ช","name":"SLEEPY FACE","synonym":null,"age":"2010สฒ","default":"emoji","annotations":["face","person","sleep"],"aliases":["sleepy"]}]
$ emspect "๐" --format "%C %G" # tell me GFM emoji code!
๐ :koko:
$ emspect -n WHITE -a symbol # name contains `WHITE` and has annotation `symbol`
๐ฎ WHITE FLOWER (U+1F4AE) - flower, object, symbol :white_flower:
โ
WHITE HEAVY CHECK MARK (U+2705) - check, mark, sign, symbol :white_check_mark:
โ WHITE QUESTION MARK ORNAMENT โ white question mark (U+2754) - mark, outlined, punctuation, question, symbol, word :grey_question:
โ WHITE EXCLAMATION MARK ORNAMENT โ white exclamation mark (U+2755) - exclamation, mark, outlined, punctuation, symbol, word :grey_exclamation:
โซ๏ธ WHITE SMALL SQUARE (U+25AB) - geometric, sign, square, symbol :white_small_square:
โป๏ธ WHITE MEDIUM SQUARE (U+25FB) - geometric, sign, square, symbol :white_medium_square:
โฝ๏ธ WHITE MEDIUM SMALL SQUARE โ white medium-small square (U+25FD) - geometric, sign, square, symbol
โฌ๏ธ WHITE LARGE SQUARE (U+2B1C) - geometric, sign, square, symbol
๐ณ WHITE SQUARE BUTTON (U+1F533) - button, geometric, outlined, sign, square, symbol :white_square_button:
โช๏ธ MEDIUM WHITE CIRCLE โ white circle (U+26AA) - circle, geometric, sign, symbol
Requirements
- Node.js >= 4
Installation
$ npm install -g emspect
Usage
Lazy Queryโข
Basic usage is just one argument to emspect like:
$ emspect sleep
$ emspect SLEEP
$ emspect ๐ช
$ emspect U+1F62A
$ emspect :sleepy:
In this case emspect estimates context of the search and returns (hopefully) suitable result. To put it concretely, it goes with following rule.
We have five searchable field for each emoji. Taking an example of ๐ค
code
--U+1F4A4
chars
--๐ค
name
--SLEEPING SYMBOL
synonym
--zzz
annotations
--comic
,emotion
,person
,sleep
,symbol
,word
,zzz
gfm
--zzz
gfm
corresponds to the emoji shortcode used widely including GitHub, Slack, etc. See Emoji Full List for the others. name
has only the words before โ
. synonym
has the after than โ
Then the field to match is depends on the query.
emspect sleep
-- Small letters matches toannotations
. It searches by exact match, e.g.,sle
doesn't match tosleep
.emspect SLEEP
-- capital letters matches toname
orsynonym
. It searches by partial match, e.g.,CAR
matches toCARD
. Note capitalization tells emspect to search byname
, however actual search is case-insensitive, soemspect FLAG
can return the emojis such as ๐ฏ๐ต (Flag for Japan
).emspect ๐ค
-- an emoji matches to the emoji directly.emspect U+1F4A4
-- letters startingU+
matchescode
. It searches by partial match, e.g.,U+1F62
matches other faces near ๐ช, such as ๐ (U+1F620
) or ๐ก (U+1F621
). AlsoU+1F3FF
matches emojis which haveTYPE-6
(the darkest) skin color like ๐๐ฟ (U+1F44D U+1F3FF
).emspect :sleep:
-- letters surrounded by:
matchesgfm
. It searchs by exact match.emspect :sle
-- letters just starting with:
also matchgfm
but conducts prefix search.
Note the spaces in the query should be quoted, and they are treated "as is", i.e., emspect do not run AND or OR search.
Search Context Options
'Please don't say "You are lazy"'? Emspect has following options which enables you to specify them.
-a <query>
or--anotations <query>
-n <query>
or--name <query>
-c <query>
or--code <query>
-C <query>
or--char <query>
-g <query>
or--gfm <query>
-- same asemspect :<query>:
. Colon can be appended. i.e.,-g :+1:
and-g +1
is same-G <query>
or--gfm-startswith <query>
-- same asemspect :<query>
When multiple options are given, emspect conducts and-search. The options can be used multiple times. Note again you must quate when the query contains space. The complete example follows:
$ emspect -n "WITH FACE" -a bright -a moon
๐ FULL MOON WITH FACE (U+1F31D) - bright, face, full, moon, nature, place, space, weather :full_moon_with_face:
All
$ emspect
Returns all emojis. Then you can pipe to grep
or any commands so that you can
cook them as you want๐ณ . --format all
options, described below, should be
useful.
Formatting
-f <format>
or --format <format>
option customizes the outputs. <format>
is string, can contain following descriptors.
%c
-- Extracted tocode
, e.g.U+1F62A
%C
-- Extracted tochars
, e.g.๐ช
%n
-- Extracted toname
, e.g.SLEEPY FACE
%s
-- Extracted tosynonym
, e.g.zzz
for๐ค SLEEPING SYMBOL
%a
-- Extracted toannotations
. Comma (with space) separated, e.g.+1, body, hand, person, thumb, thumbs up, up
%g
-- Extracted togfm
. Comma (with space) separated, e.g.+1, thumbsup
%G
-- Similar togfm
, but adds colons, e.g.:+1:, :thumbsup:
%y
-- Extracted toyear
, e.g.2010สฒสท
%d
-- Extracted todefault presentation style
, e.g.emoji
%?s(<foo>)
-- Extracted to<foo>
if hassynonym
. Othewise print nothing.%?g(<foo>)
-- Extracted to<foo>
if hasgfm
. Othewise print nothing.
For details of year
and default presentation style
, see
http://unicode.org/emoji/charts/index.html#emoji-data-chart-key .
There are two special format options.
--format all
-- Prints all data in tab-separated. Could be useful with pipes. It is same to--format "%c\t%C\t%n\t%s\t%y\t%d\t%a\t%G"
--format json
-- Prints all data in JSON. Could be useful with jq. Also building your cool emoji web API.
OR Search
Currently we doesn't provide or-search, but you can ealisly achieve it with sub-shell.
$ (emspect -a man -a person & emspect -a woman -a person) | sort | uniq
This shows the results like that (man AND person) OR (woman AND person)
.
Note we need | sort | uniq
to remove dupulicates. Compare to
$ (emspect -a man -a person & emspect -a woman -a person)
then you can find ๐ซ
, i.e., man AND woman
is duplicated. One more tip that
(emspect foo & emspect bar)
is faster than (emspect foo && emspect bar)
or
(emspect foo; emspect bar)
because &
executes commands in parallel.
For more details, taking a look of ./test/emojis.js
will help your understand.
More Examples
See Wiki!
Acknowledgement
Emspect employs unicode.org's Full Emoji Data and github/gemoji's emoji.json to generate our emojiData.json.
License
Copyright (c) 2016 mecab
Emspect is released under the MIT license.