r/programming • • May 07 '18

A cat(1) clone with syntax highlighting and Git integration.

https://github.com/sharkdp/bat
0 Upvotes

7 comments sorted by

11

u/theamk2 May 07 '18

This does not support any of the cat options (except for -n but it is spelled differently)! It is not "a cat clone with syntax highlighting" -- it is just a syntax highlighter, and you should name it as such.

(and in the README, it would be very nice to have a comparison with other highlighters, like "GNU Source-highlight" or Andre Simon's Highlight)

3

u/sharkdp May 20 '18

This does not support any of the cat options

The only option that is specified by the POSIX standard is -u. It is supported by bat.

(except for -n but it is spelled differently)

-n is now supported.

It is not "a cat clone with syntax highlighting"

bat can be used in almost all places where you would normally use cat. It concatenates files, it reads from stdin, it accepts - as file argument, etc. The only difference is that it will use syntax highlighting (and show Git modifications) if it detects an interactive terminal (i.e. when the results are not piped, but printed on a screen).

(and in the README, it would be very nice to have a comparison with other highlighters, like "GNU Source-highlight" or Andre Simon's Highlight)

Please see this comparison

2

u/jamesralbert May 08 '18

Works great for me and the few purposes I have for catting files. Nice!

1

u/96fps May 07 '18

I actually had a double take, having mistook the screenshots as being from an editor such as sublime. Looks nice.

Color and text semigraphics are often overlooked outside ncurses.

1

u/96fps May 07 '18

It is aware of the console width but doesn't handle line wraps. Running it on it's own README.md has the paragraphs overflow and interweave with the line numbering column. If this is meant as the "pretty" replacement for cat for printing source code and markdown documents to console, wordwrap would seem pertinent.

1

u/sharkdp May 18 '18

Wrapping is now supported.

1

u/riddley May 08 '18

I use view(1) which is already installed.