Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/owenthereal/ccat
Colorizing `cat`
https://github.com/owenthereal/ccat
Last synced: about 15 hours ago
JSON representation
Colorizing `cat`
- Host: GitHub
- URL: https://github.com/owenthereal/ccat
- Owner: owenthereal
- License: mit
- Created: 2015-05-06T05:00:17.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-09-05T17:44:40.000Z (over 2 years ago)
- Last Synced: 2024-10-29T23:35:55.600Z (3 months ago)
- Language: Go
- Homepage: https://github.com/owenthereal/ccat
- Size: 2.5 MB
- Stars: 3,164
- Watchers: 41
- Forks: 119
- Open Issues: 37
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-tools - ccat - 支持高亮的 cat,更推荐 [bat](https://github.com/sharkdp/bat)。 (Command Line / Dependency Management)
- awesome-ops - owenthereal/ccat - 05-06|2022-09-05 | ccat是着色cat。它的工作原理与此类似,cat但显示带有语法突出显示的内容。 | (终端命令行工具)
- fucking-Awesome-Linux-Software - ![Open-Source Software - Colorizing `cat`. (Command Line Utilities / Tools)
- Awesome-Linux-Software - ![Open-Source Software - Colorizing `cat`. (Command Line Utilities / Tools)
README
# ccat
[![OpenCollective](https://opencollective.com/ccat/backers/badge.svg)](#backers)
[![OpenCollective](https://opencollective.com/ccat/sponsors/badge.svg)](#sponsors)`ccat` is the colorizing `cat`. It works similar to `cat` but displays content with syntax highlighting.
## Supported Languages
* JavaScript
* Java
* Ruby
* Python
* Go
* C
* JSON## Installation
### OSX
```
$ brew install ccat
```### Arch Linux
```
$ pacaur -S ccat
$ pacaur -S ccat-git
```
The ccat package will reflect the current release snapshot, while the ccat-git will be based on the current source available in the master branch of the git repo. You can use any AUR helper in place of pacaur [AUR Helpers](https://wiki.archlinux.org/index.php/AUR_helpers)### Standalone
`ccat` can be easily installed as an executable.
Download the latest [compiled binaries](https://github.com/owenthereal/ccat/releases) and put it in your executable path.### From source
Prerequisites:
- [Git](http://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
- [Go](https://golang.org/doc/install) 1.4+```
$ go get -u github.com/owenthereal/ccat
```## Completion (ZSH Only)
### Installation
Move the `_ccat` file in `./completions/zsh` to your site-functions directory usually in `/usr/local/share/zsh/site-functions` or in `/usr/share/zsh/site-functions`. If completions don't work on the next ZSH startup, you can delete the file `.zcompdump` (which caches autocomplete commands) and it is usually in the home directory.
### Uninstallation
Go back to the directory you copied `_ccat` to and delete the file, then simply delete `.zcompdump` in order to stop errors when trying to use `ccat` autocomplete afterwards.## Usage
```
$ ccat FILE1 FILE2 ...
$ ccat FILE1 FILE2 ... --html # output in HTML
$ ccat --bg=dark FILE1 FILE 2 ... # dark background
$ ccat -G String="_darkblue_" -G Plaintext="darkred" FILE # set color codes
$ ccat --palette # show palette
$ ccat # read from standard input
$ curl https://raw.githubusercontent.com/owenthereal/ccat/master/main.go | ccat
```It's recommended to alias `ccat` to `cat`:
```
alias cat=ccat
```The overhead of `ccat` comparing to `cat` is mimimum:
```
$ wc -l main.go
123 main.go
$ time cat main.go > /dev/null
cat main.go > /dev/null 0.00s user 0.00s system 61% cpu 0.005 total
$ time ccat main.go > /dev/null
ccat main.go > /dev/null 0.00s user 0.00s system 78% cpu 0.007 total
```You can always invoke `cat` after aliasing `ccat` by typing `\cat`.
## Demo
[![demo](https://asciinema.org/a/21858.png)](https://asciinema.org/a/21858)
## Roadmap
- [ ] nicer default color scheme
- [ ] ?## Alternatives
`ccat` is designed to be distributed in one binary, run at native speed
and follow the POSIX standards. There're alternatives out there.
Use them at your own risk :):* [pygments](http://pygments.org/)
* [source-highlight](https://www.gnu.org/software/src-highlite/)## License
[MIT](https://github.com/owenthereal/ccat/blob/master/LICENSE)
## Credits
Thanks to [Sourcegraph](https://github.com/sourcegraph) who built [this](https://github.com/sourcegraph/syntaxhighlight) awesome syntax-highlighting package.
## Support
### Backers
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/ccat#backer)]### Sponsors
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/ccat#sponsor)]