Skip to content
mohamedationPublic

About

modular terminal animations in Go, zero dependencies

Resources

Stars

13 stars

Watchers

0 watching

Forks

Repository files navigation

GoTermFX

GoTermFX

Terminal animations for people who spend too much time in the terminal.

Go Version Go Reference Test codecov License: MIT


GoTermFX is a zero-dependency terminal animation CLI written in Go. Rain, matrix, fireworks, hyperspace, snow — all running directly in your terminal, all cancellable with a single keypress. You can also drop in your own animations with about 10 lines of Go.

Install

go install github.com/mohamedation/gotermfx@latest

Build from source

git clone https://github.com/mohamedation/gotermfx.git
cd gotermfx
make build        # compiles to ./bin/gotermfx
make install      # installs to /usr/local/bin
make uninstall    # removes it
make clean        # removes ./bin

You can also run without installing:

make run                  # runs a random animation
make run ARGS=matrix      # run a specific one

Tests

make test    # run unit tests
make cover   # run tests with coverage summary

Usage

gotermfx                  # random animation
gotermfx matrix           # run a specific one
gotermfx -i               # interactive picker
gotermfx -1               # run once then exit
gotermfx -1 -d 5s         # with a max duration for animations with a sequence
gotermfx -h               # help

Press any key to stop.

Animations

Matrix

Classic. had to include it and cant forget about CMatrix which is one of the OG out there

Matrix animation


WarGHOST

WarGames is one of my fav movie. I had to include this.

WarGHOST animation

ps. only a demo

WikiDecrypt

Sneakers is also one of the best OG pentesters story. WikiDecrypt Fetches a random Wikipedia article and reveals it character by character, like in the movie and also like no-more-secrets by bartobri

WikiDecrypt animation


Hyperspace

Hyperspace animation


Rain

Rain animation


Fireworks

Fireworks animation


Snow

Snow animation


Starfield

Starfield animation


Add Your Own

The whole thing is built around a single interface:

type Animation interface {
    Run(ctx context.Context)
}

Create a file in animations/, implement Run, register it in init, and it shows up automatically:

package animations

import (
    "context"
    "gotermfx/termfx"
)

type myAnimation struct{}

func (a *myAnimation) Run(ctx context.Context) {
    for {
        select {
        case <-ctx.Done():
            return
        default:
            // draw something
        }
    }
}

func init() {
    termfx.Register("MyAnimation", &myAnimation{})
}

PRs welcome.

License

MIT — do whatever you want with it.

About

modular terminal animations in Go, zero dependencies

Resources

Stars

13 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages