Writing a cat (and bat) clone in Go for learning purposes
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 .
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.