Wednesday, November 04, 2015

Sexy terminal output - with figlet, lolcat and cowsway on MacOSX #figlet #lolcat #cowsay

I was watching today a short video by the Docker guys on how to setup the new multi host network capabilities, just introduced with Docker 1.9. In the beginning, the engineer doing the demo was 'echoing'  in his terminal screen some very cool, labels and text. Eventually was piping echo to a tool called figlet (I knew it before- ASCII generator) and then to another tool called lolcat. The output is more than cool !!! I thought, I need to have this as well.  Have a look!



Another famous, variation in code comments is cowsay



So I started brew and brew casking the relevant tools! You need to have brew and brew cask installed, if not see here or here.

Install figlet 

 

brew install figlet

Install lolcat /cowsay

Lolcat and cowsay can be installed using  ruby gem. The thing is that trying to do something like

gem install lolcat 

was producing errors for access rights in various paths - especially if you are using MacOSX YoseMite (10.10) or ElCapitan (10.11) . I searched a bit, tried a couple of stuff like deleting the relevant folders, updating gem but no luck. If you dont have any errors skip the following rbenv tips and just install the tools.

In order to get my gem (ruby) stuff working, I followed the instructions here. 

brew install rbenv ruby-build

# Add rbenv to bash so that it loads every time you open a terminal
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
source ~/.bash_profile

# Install Ruby
rbenv install 2.2.3
rbenv global 2.2.3
ruby -v

After the above I could install lolcat and cowsay or fortune.

gem install lolcat 

gem install cowsay 

gem install fortune



And you are done, happy cool comments in your code / scripts or just terminal! Nice for demos as well, credits to Dave Tucker from Docker  for the inspiration!




No comments:

Post a Comment