Skip to content

A go program to pipe emoji's aliases and get the actual symbol ⚡

Notifications You must be signed in to change notification settings

math2001/goemoji

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GoEmoji

I spent some time looking for something really simple: I wanted to be able to do this:

$ echo 'Hello world :tada:' | someprogram
Hello world 🎉

I didn't find one quickly enough, and as I want to learn go, I thought that doing it myself could be a good task (and it was 😄 I learned a 💩-load of new stuff 🎉)

To get it working on your machine, just grab the latest .exe from the tags, and add an alias to it or add it in your PATH.

# .bashrc
alias goemoji="path/to/goemoji.exe $*"

Note: the $* at then end allows to give arguments

Now, you can do

$ echo 'I :heart: code' | goemoji
I ❤ code

You can also build it yourself, it's simple:

$ go build goemoji.go

🎉

Add a suffix

I'm on Windows, and I'm using Hyper. At this time, Hyper has a bug, emoji take too much room, which "eat" the following char. The solution to prevent this is to add a space just after (so that it eats the space).

Note: this bug has been fixed in the version 1.3.1 of Hyper. But I'll leave this feature, it might be useful for some people.

So, you can specify a suffix by passing it as an argument:

$ git log | goemoji " "

Or by setting it as an environment variable:

$ export GOEMOJI_SUFFIX=" "
$ git log | goemoji

--color=always

Plenty of program add color to their output only if the destination is a terminal. So, when you pipe it, it doesn't use colors (so you get emoji, but no color 😞). It's the case for git log.

Fortunatly, there's often an option to oblige colored output. For git log, it's --color=always

$ git log --color="always" --oneline --graph --decorate -10 --all | goemoji

😉

That's it! Hope you enjoy it (don't forget to ⭐ this repo if it did 😄)

About

A go program to pipe emoji's aliases and get the actual symbol ⚡

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages