rubychan / coderay

Fast and easy syntax highlighting for selected languages, written in Ruby.
http://coderay.rubychan.de/
Other
846 stars 115 forks source link

Add support for input from STDIN #110

Open hackonteur opened 11 years ago

hackonteur commented 11 years ago

Many UNIX utilities allow you to give an input filename on the command line or just pipe to STDIN. For example, these are equivalent:

less foo.txt
cat foo.txt | less

I would like coderay to take the input from STDIN if one is not given on the command-line. This would be particularly helpful with diff output:

diff -U1 foo.txt bar.txt | coderay -diff

This would be useful in conjunction with #111: Add smart detection of input language

korny commented 11 years ago

I would like coderay to take the input from STDIN if one is not given on the command-line.

Actually, it should already do that.

korny commented 11 years ago

I get this with CodeRay 1.0.x:

> echo 'puts "Hello, world!"' | coderay -ruby
puts "Hello, world!"

What do you get?