pokesay-go

command module
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2022 License: MIT Imports: 13 Imported by: 0

README

pokesay-go

A (much) faster go version of tmck-code/pokesay


pokesay-demo-3


One-line installs

Click to expand!
  • OSX / darwin
    bash -c "$(curl https://raw.githubusercontent.com/tmck-code/pokesay-go/master/scripts/install.sh)" bash darwin amd64
    
  • OSX / darwin (M1)
    bash -c "$(curl https://raw.githubusercontent.com/tmck-code/pokesay-go/master/scripts/install.sh)" bash darwin arm64
    
  • Linux x64
    bash -c "$(curl https://raw.githubusercontent.com/tmck-code/pokesay-go/master/scripts/install.sh)" bash linux amd64
    
  • Android ARM64 (Termux)
    bash -c "$(curl https://raw.githubusercontent.com/tmck-code/pokesay-go/master/scripts/install.sh)" bash android arm64
    

How it works

This project extends on the original fortune | cowsay, a simple command combo that can be added to your .bashrc to give you a random message spoken by a cow every time you open a new shell.

 ☯ ~ fortune | cowsay
 ______________________________________
/ Hollywood is where if you don't have \
| happiness you send out for it.       |
|                                      |
\ -- Rex Reed                          /
 --------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

These pokemon sprites used here are sourced from the awesome repo msikma/pokesprite

sprits

All of these sprites are converted into a form that can be rendered in a terminal (unicode characters and colour control sequences) by the img2xterm tool, found at rossy/img2xterm

The last pre-compile step is to use encoding/gob and go:embed to generate a go source code file that encodes all of the converted unicode sprites as gzipped text.

Finally, this is built with the main CLI logic in pokesay.go into an single executable that can be easily popped into a directory in the user's $PATH

If all you are after is installing the program to use, then there are no dependencies required! Navigate to the Releases and download the latest binary.

TODO

  • Short-term
    • Fix bad whitespace stripping when building assets
    • List all names
  • Longer-term
    • Make data structure to hold categories, names and pokemon
    • Increase speed
    • Improve categories to be more specific than shiny/regular

Building binaries

In docker

Dependencies: docker

In order to re/build the binaries from scratch, along with all the cowfile conversion, use the handy Makefile tasks

cd build && make build/docker build/assets build/release

This will produce 4 executable bin files inside the build/bin directory, and a heap of binary asset files in build/assets.

On your host OS

You'll have to install a golang version that matches the go.mod, and ensure that other package dependencies are installed (see the dockerfile for the dependencies)

# Generate binary asset files from the cowfiles
./build/build_assets.sh

# Finally, build the pokesay tool (this builds and uses the build/pokedex.gob file automatically)
go build pokesay.go

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
src
bin
bin/convert command
bin/pokedex command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL