Build a CLI Emoji Picker with fzf and Nix
In my blog post yesterday, I mentioned fzf. Its simplicity and power make it a good tool for many scripting tasks. In this post, we will see a practical example of how to use it in a CLI program and package it with Nix. fzf Part fzf is a "command-line fuzzy finder". But, its API offers a few features that make it a small UI framework. Let us see it in action. Our job is to create a simple CLI program that lists all GitHub Emojis, lets the user search for one and copy either the selected emoji or its :EMOJICODE: to the clipboard. I found the list of emojis in the github/gemoji repository, in particular in the following file: https://github.com/github/gemoji/blob/master/db/emoji.json To reference it below, we will assign its raw file URL to the environment variable FZF_EMOJI_DATA_FILE: export FZF_EMOJI_DATA_FILE=https://raw.githubusercontent.com/github/gemoji/0eca75db9301421efc8710baf7a7576793ae452a/db/emoji.json It looks like this: $ curl -sSL "${FZF_EMOJI_DATA_FILE}" | jq . | head -n 15 [ { "emoji": "

In my blog post yesterday, I mentioned fzf. Its simplicity and power make it a good tool for many scripting tasks. In this post, we will see a practical example of how to use it in a CLI program and package it with Nix.
fzf
Part
fzf is a "command-line fuzzy finder". But, its API offers a few features that make it a small UI framework.
Let us see it in action.
Our job is to create a simple CLI program that lists all GitHub Emojis, lets the user search for one and copy either the selected emoji or its :EMOJICODE:
to the clipboard.
I found the list of emojis in the github/gemoji repository, in particular in the following file:
https://github.com/github/gemoji/blob/master/db/emoji.json
To reference it below, we will assign its raw file URL to the environment variable FZF_EMOJI_DATA_FILE
:
export FZF_EMOJI_DATA_FILE=https://raw.githubusercontent.com/github/gemoji/0eca75db9301421efc8710baf7a7576793ae452a/db/emoji.json
It looks like this:
$ curl -sSL "${FZF_EMOJI_DATA_FILE}" | jq . | head -n 15
[
{
"emoji": "