Skip to content
/ rat Public
generated from Yakiyo/go-template

Making a cat clone for learning purposes

License

Notifications You must be signed in to change notification settings

Yakiyo/rat

Repository files navigation

rat

ci GitHub go.mod Go version (subdirectory of monorepo) GitHub tag (with filter)

Writing a cat (and bat) clone in Go for learning purposes

Installation

Installation of it requires the Go toolchain.

$ go install github.com/Yakiyo/rat

or the repository can be locally cloned and installed too.

$ git clone https://github.com/Yakiyo/rat

$ cd rat

$ go build .

Usage

It works similar to cat

# pretty print a js file
$ rat index.js

# print multiple files of different language
$ rat index.js main.go

# implicitly mention language to use
$ rat --language typescript index.js

# choose a style
$ rat --style githubdark main.cpp

# read from stdin
$ echo "console.log('hello')" | rat

# first print README, then use stdin and then index.js
$ rat README.md - index.js

# disable pretty printing (print plain text)
$ rat --style none app.py

For syntax highlighting, the chroma library is used. A list of supported languages can be found here. All available chroma styles can be viewed at the styles gallery.