21
emocli is a command-line interface for emoji selection with gitmoji support
I've recently gotten into the habit of using gitmoji in my commit messages, and I've decided that I really like having visual cues in my commit logs. I think the added visual image helps with quickly associating each commit with the type of work that was done. Now that I'm hooked on this practice, my brain really doesn't want me to go back.
While there is gitmoji-cli, there are times when I just want to use another emoji that has not been incorporated into the gitmoji project. For example, I may use a cookie (🍪) when writing a commit message related to work on HTTP cookies, or a vomiting face (🤮) for a commit which adds a lot of debug statements.
For these other emoji characters, one would typically need to turn to a helper application like the KDE Emoji Picker, the Gnome Emoji Selector, or a web browser with Emojipedia. There are also extensions for the rofi utility (rofi-emoji and rofimoji) which allow a lightweight solution for those not in full desktop environments.
I created emocli to provide a command-line interface for searching and selecting emoji characters from a combined dataset that uses information from Unicode, Inc. and also the gitmoji project.
npm install -g @duhdugg/emocli
Usage: emocli [OPTIONS] <search>
OPTIONS:
-h | --help print this help
-l | --list list all emoji characters
-i | --info include info
-n | --name match name exactly
list all emoji characters with their name, categories, keywords, and gitmoji description (if available)
emocli -li
emocli -i dog
# output
🐶 dog face | Animals & Nature / animal-mammal | dog,face,pet
🐕 dog | Animals & Nature / animal-mammal | dog,pet
🦮 guide dog | Animals & Nature / animal-mammal | accessibility,blind,guide,guide dog
🐕🦺 service dog | Animals & Nature / animal-mammal | accessibility,assistance,dog,service
🐩 poodle | Animals & Nature / animal-mammal | dog,poodle
🌭 hot dog | Food & Drink / food-prepared | frankfurter,hot dog,hotdog,sausage
if the name is more than one word, it should be enclosed in quotes
emocli -n 'guide dog'
# output
🦮
git commit -m "$(emocli -n rocket) production launch"
The following script provides similar functionality to the rofi extensions mentioned above (using rofi and xclip).
# put this somewhere as a script in your PATH, shell alias, or keyboard shortcut
emocli -li | rofi -dmenu -window-title emoji | cut -d' ' -f1 | tr -d '\n' | xclip -selection clipboard
Your mileage may vary on terminal support for displaying emoji consisting of 2 or more characters joined by a zero-width joiner character (U+200D). The "service dog" emoji (🐕🦺) is one such example. Even with a proper font config, it will appear on many terminals as a dog next to a safety vest.
🐕🦺
Currently, the best configuration tested with emocli -li
is the kitty terminal with the Noto Color Emoji font installed and configured in your fontconfig.