Skip to content

Commit 8e0d6f6

Browse files
committed
Use STDIN if no arguments
1 parent 4d080ee commit 8e0d6f6

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ ruby -run -e touch -- [OPTION] FILE
3333
ruby -run -e wait_writable -- [OPTION] FILE
3434
ruby -run -e mkmf -- [OPTION] EXTNAME [OPTION]
3535
ruby -run -e httpd -- [OPTION] [DocumentRoot]
36-
ruby -run -e colorize -- FILE
36+
ruby -run -e colorize -- [FILE]
3737
ruby -run -e help [COMMAND]
3838
```
3939

lib/un.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# ruby -run -e wait_writable -- [OPTION] FILE
2424
# ruby -run -e mkmf -- [OPTION] EXTNAME [OPTION]
2525
# ruby -run -e httpd -- [OPTION] [DocumentRoot]
26-
# ruby -run -e colorize -- FILE
26+
# ruby -run -e colorize -- [FILE]
2727
# ruby -run -e help [COMMAND]
2828

2929
require "fileutils"
@@ -358,7 +358,7 @@ def httpd
358358
##
359359
# Colorize ruby code.
360360
#
361-
# ruby -run -e colorize -- FILE
361+
# ruby -run -e colorize -- [FILE]
362362
#
363363

364364
def colorize
@@ -368,6 +368,10 @@ def colorize
368368
raise "colorize requires irb 1.1.0 or later"
369369
end
370370
setup do |argv, |
371+
if argv.empty?
372+
puts IRB::Color.colorize_code STDIN.read
373+
return
374+
end
371375
argv.each do |file|
372376
puts IRB::Color.colorize_code File.read(file)
373377
end

0 commit comments

Comments
 (0)