From 2eed62fb65a93721bad32ecf79413b67320b61de Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Wed, 7 Apr 2021 10:35:37 +0900 Subject: [PATCH] [ruby/un] Use STDIN if no arguments https://github.com/ruby/un/commit/8e0d6f62cb --- lib/un.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/un.rb b/lib/un.rb index 75426ba17e..5feac92120 100644 --- a/lib/un.rb +++ b/lib/un.rb @@ -23,7 +23,7 @@ # ruby -run -e wait_writable -- [OPTION] FILE # ruby -run -e mkmf -- [OPTION] EXTNAME [OPTION] # ruby -run -e httpd -- [OPTION] [DocumentRoot] -# ruby -run -e colorize -- FILE +# ruby -run -e colorize -- [FILE] # ruby -run -e help [COMMAND] require "fileutils" @@ -377,7 +377,7 @@ end ## # Colorize ruby code. # -# ruby -run -e colorize -- FILE +# ruby -run -e colorize -- [FILE] # def colorize @@ -387,6 +387,10 @@ def colorize raise "colorize requires irb 1.1.0 or later" end setup do |argv, | + if argv.empty? + puts IRB::Color.colorize_code STDIN.read + return + end argv.each do |file| puts IRB::Color.colorize_code File.read(file) end