https://github.com/yakiyo/rat
Making a cat clone for learning purposes
https://github.com/yakiyo/rat
bat cat chroma go rat unix-shell
Last synced: 8 months ago
JSON representation
Making a cat clone for learning purposes
- Host: GitHub
- URL: https://github.com/yakiyo/rat
- Owner: Yakiyo
- License: mit
- Created: 2024-01-09T15:08:41.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-14T10:44:49.000Z (over 1 year ago)
- Last Synced: 2024-12-28T00:43:37.520Z (10 months ago)
- Topics: bat, cat, chroma, go, rat, unix-shell
- Language: Go
- Homepage:
- Size: 29.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rat
[](https://github.com/Yakiyo/rat/actions/workflows/ci.yml)  Writing a cat (and [bat](https://github.com/sharkdp/bat)) clone in Go for learning purposes
## Installation
Installation of it requires the [Go](https://go.dev) toolchain.```bash
$ go install github.com/Yakiyo/rat
```
or the repository can be locally cloned and installed too.```bash
$ git clone https://github.com/Yakiyo/rat$ cd rat
$ go build .
```## Usage
It works similar to cat
```shell
# 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](https://github.com/alecthomas/chroma) library is used. A list of supported languages can be found [here](https://github.com/alecthomas/chroma#supported-languages). All available chroma styles can be viewed at the [styles gallery](https://xyproto.github.io/splash/docs/).