• Stars
    star
    3,105
  • Rank 13,882 (Top 0.3 %)
  • Language
    Go
  • License
    MIT License
  • Created about 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Colorizing `cat`

ccat

OpenCollective OpenCollective

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

Standalone

ccat can be easily installed as an executable. Download the latest compiled binaries and put it in your executable path.

From source

Prerequisites:

$ 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

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 :):

License

MIT

Credits

Thanks to Sourcegraph who built this awesome syntax-highlighting package.

Support

Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]

Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]

More Repositories

1

godzilla

Godzilla is a ES2015 to Go source code transpiler and runtime
Go
1,482
star
2

hacker-menu

Hacker News Delivered to Desktop 👯
JavaScript
1,004
star
3

upterm

Instant Terminal Sharing
Go
769
star
4

gh

Fast GitHub command line client (deprecated). gh has been merged into https://github.com/github/hub, see https://github.com/github/hub/issues/475 for more info
Go
717
star
5

jqplay

A playground for jq, written in Go
Go
697
star
6

thunderbird

⚡🐦 Elegant WebSockets in Go
JavaScript
511
star
7

goup

Elegant Go installer
Go
478
star
8

spotctl

A command-line interface to Spotify, written in Go
Go
242
star
9

nut

Vendor Go dependencies
Go
234
star
10

gotask

Idiomatic build tool in Go
Go
177
star
11

jekyll_and_hyde

A HTML presentation generator that generates a basic Jekyll scaffold with Slippy hooking up.
Ruby
174
star
12

candy

Candy is a zero-config reverse proxy server
Go
119
star
13

devise_uid

Add UID support to Devise.
Ruby
61
star
14

gaffer

Gaffer - Foreman on JVM
Java
56
star
15

msgpack_rails

MessagePack for Rails / msgpack.org[Rails]
Ruby
45
star
16

conf

Configuration loader in Go
Go
31
star
17

negroni-gorelic

negroni_gorelic is NewRelic middleware for negroni framework.
Go
27
star
18

gundam

The most destructive robot
Go
18
star
19

sql_parser

A Ruby SQL parser based on Treetop.
Ruby
18
star
20

vimux-zeus

vimux and zeus in action.
Vim Script
14
star
21

go-get-nuts

HTML5 Game built with Phaser
JavaScript
10
star
22

heroic_haiku

A simple game that is written in Flutter and Flame.
Dart
10
star
23

heroku-buildpack-wasmer

Heroku Buildpack for Wasmer
Shell
8
star
24

osh

The O shell
Go
8
star
25

jruby_sinatra_activerecord

A template app to run JRuby with Sinatra and ActiveRecord
Ruby
7
star
26

travisarchive

Travis Archive
Go
7
star
27

blog

My blog
JavaScript
6
star
28

dotfiles_old

My dotfiles
Shell
6
star
29

git-rebase-merge

A bash script to rebase and merge a Git topic branch to current branch.
Shell
5
star
30

homebrew-ccat

Homebrew fomular for `ccat` (deprecated), use `brew install ccat` instead
Ruby
4
star
31

message_queue

A common interface to multiple message queues libraries.
Ruby
4
star
32

eventloopclass

Go version of the exercises for The Truth About Event Loop Online Masterclass
Go
4
star
33

codeface

Run web-based VS Code on Heroku
Go
3
star
34

cheatsheets

3
star
35

codefaces

a web-based source control client
Java
3
star
36

patching_with_class_shadowing_and_maven

Using Maven to help with class shadowing.
Java
3
star
37

dotfiles

My dotfiles
Shell
3
star
38

hdp

HTTP Debug Proxy (HDP) logs HTTP requests for inspection.
Go
3
star
39

com.google.dart.compiler

A Dart compiler implemented in Java extracted from Dart's official repository.
Java
3
star
40

maven_jetty_plugin_example

Speed Up J2EE Environment Setup With Jetty Maven Plugin Example
Java
2
star
41

.dotfiles

dotfiles for my Mac
Ruby
2
star
42

priority_test

Run tests in priority order.
Ruby
2
star
43

mag

MAG - Full-Stack application development using MongoDB, AngularJS, and Go
2
star
44

ruby_grep

Module to search file(s) for lines that match a given pattern.
Ruby
2
star
45

rbfmt

Format Ruby code
Ruby
2
star
46

tic_tac_toe_engine

A dead simple Tic Tac Toe engine.
Ruby
2
star
47

homebrew-gh

GH formulae for the Homebrew package manager
Ruby
2
star
48

testing_rest_web_services_with_rails

Ruby
2
star
49

StoryboardRecipes

Example app following the book "iOS SDK Development" from Pragmatic Programmer
Objective-C
2
star
50

gostart

Go
1
star
51

twitter_plus

an example of my talk about testing web service client
Ruby
1
star
52

isittheday.com

Ruby
1
star
53

jekyll_and_hyde_demo

An example presentation generated by jekyll_and_hyde
1
star
54

stats_foundry

Ruby
1
star
55

ijws

I Just Wanna Say
Ruby
1
star
56

karotz-proxy

Ruby
1
star
57

rails_engines_spike

Ruby
1
star
58

vpm

An awesome utility for managing Vim plugins.
Ruby
1
star
59

heroku-nginx-wasmer

Run Nginx with Wasmer on Heroku
HTML
1
star
60

api-proxy-spike

A spike to implement an API proxy
JavaScript
1
star
61

automatic_testing_of_rest_web_sevices_client_with_rails_source

Ruby
1
star
62

cortana

A Hubot for Twitter
CoffeeScript
1
star
63

odt

Owen's Development Tool
Go
1
star
64

rab

Rails Asset Builder (RAB)
Ruby
1
star
65

summarize-github-pull-requests

Perform automatic code reviews for GitHub pull requests (PR). The review is triggered when a PR is created and is triggered again for every subsequent commit in the PR. The code review is conducted for commit in the PR.
Rust
1
star
66

buildzilla

Ruby
1
star
67

shortenerclj

A URL shortener implemented in Clojure
Clojure
1
star
68

hurley

Hurley and Faraday are both from the lost island
Go
1
star
69

sinatra-jruby-heroku

Shell
1
star
70

jekyll_and_hyde_template

The source of the default jekyll_and_hyde template used by its generator.
1
star
71

gameserverstatus

gameserverstatus
Clojure
1
star
72

narc

Node.js CI Server
JavaScript
1
star
73

loading_path_gotchas_in_rails3

A gotchas on load path of Rails 3.
Ruby
1
star
74

testing_web_services_client_slides

JavaScript
1
star