[前][次][番号順一覧][スレッド一覧]

ruby-changes:67236

From: Kazuhiro <ko1@a...>
Date: Tue, 24 Aug 2021 18:02:58 +0900 (JST)
Subject: [ruby-changes:67236] 2eed62fb65 (master): [ruby/un] Use STDIN if no arguments

https://git.ruby-lang.org/ruby.git/commit/?id=2eed62fb65

From 2eed62fb65a93721bad32ecf79413b67320b61de Mon Sep 17 00:00:00 2001
From: Kazuhiro NISHIYAMA <zn@m...>
Date: Wed, 7 Apr 2021 10:35:37 +0900
Subject: [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 75426ba..5feac92 100644
--- a/lib/un.rb
+++ b/lib/un.rb
@@ -23,7 +23,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/un.rb#L23
 #   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 https://github.com/ruby/ruby/blob/trunk/lib/un.rb#L377
 ##
 # Colorize ruby code.
 #
-#   ruby -run -e colorize -- FILE
+#   ruby -run -e colorize -- [FILE]
 #
 
 def colorize
@@ -387,6 +387,10 @@ def colorize https://github.com/ruby/ruby/blob/trunk/lib/un.rb#L387
     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
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]