Crates.io | emorand |
lib.rs | emorand |
version | 1.0.1 |
source | src |
created_at | 2022-11-06 23:37:38.006199 |
updated_at | 2022-11-11 16:41:24.196406 |
description | Just a random emoji |
homepage | |
repository | https://gitlab.com/julienjpk/emorand |
max_upload_size | |
id | 706819 |
size | 71,100 |
Prints a random emoji to stdout.
"Why?" they asked.
I wanted a random emoji in my bash prompt, and I didn't want to save a subset of "acceptable" emojis to pick from with $RANDOM
into by .bashrc
. I wanted all* of the emojis, a surprise at every prompt. I'm wild like that.
"But why Rust?" they asked, unquestionably inquisitively.
Because Rust is awesome and was, this time at least, more satisfying than bash scripting.
$ emorand
👏
The first time you run it might take a little bit longer: it will build a cache from the online list of emoji sequences. After that, it should be pretty fast.
If you want it in your bash prompt like I do, you'll need to do some ~/.bashrc
magic. If you want a new emoji per terminal, use:
PS1="$(emorand) > "
If you feel really fancy (like I do), you may define PROMPT_COMMAND
instead to get a new emoji at every prompt:
emorand_prompt() { PS1="$(emorand) > "; }
PROMPT_COMMAND=emorand_prompt
If you, too, like to have git info and other stuff like that in your prompt, you probably already have such a function, which you may simply adjust.
As of this writing, emorand has yet to be published to distribution repositories (I know, shocking). Until this blessed day comes, you may get it from crates.io with:
$ cargo install emorand
Or build and install it from source with:
$ cargo build --release
How and where you install it then is up to you. I, for one, have chosen to simply use install
...
$ sudo install -m0755 target/release/emorand /usr/local/bin
* Ok, so I lied, it doesn't actually print any emoji. Those that are defined by unicode sequences (eg. skin tones, flags, ...) will never show up. Two reasons:
Maybe I'll try to figure out a way to fix this later ;-)
emorand is released under the terms of the AGPL 3.0 (or later).