[ruby/un] Use STDIN if no arguments
https://github.com/ruby/un/commit/8e0d6f62cb
This commit is contained in:
parent
66abeb0370
commit
2eed62fb65
@ -23,7 +23,7 @@
|
|||||||
# ruby -run -e wait_writable -- [OPTION] FILE
|
# ruby -run -e wait_writable -- [OPTION] FILE
|
||||||
# ruby -run -e mkmf -- [OPTION] EXTNAME [OPTION]
|
# ruby -run -e mkmf -- [OPTION] EXTNAME [OPTION]
|
||||||
# ruby -run -e httpd -- [OPTION] [DocumentRoot]
|
# ruby -run -e httpd -- [OPTION] [DocumentRoot]
|
||||||
# ruby -run -e colorize -- FILE
|
# ruby -run -e colorize -- [FILE]
|
||||||
# ruby -run -e help [COMMAND]
|
# ruby -run -e help [COMMAND]
|
||||||
|
|
||||||
require "fileutils"
|
require "fileutils"
|
||||||
@ -377,7 +377,7 @@ end
|
|||||||
##
|
##
|
||||||
# Colorize ruby code.
|
# Colorize ruby code.
|
||||||
#
|
#
|
||||||
# ruby -run -e colorize -- FILE
|
# ruby -run -e colorize -- [FILE]
|
||||||
#
|
#
|
||||||
|
|
||||||
def colorize
|
def colorize
|
||||||
@ -387,6 +387,10 @@ def colorize
|
|||||||
raise "colorize requires irb 1.1.0 or later"
|
raise "colorize requires irb 1.1.0 or later"
|
||||||
end
|
end
|
||||||
setup do |argv, |
|
setup do |argv, |
|
||||||
|
if argv.empty?
|
||||||
|
puts IRB::Color.colorize_code STDIN.read
|
||||||
|
return
|
||||||
|
end
|
||||||
argv.each do |file|
|
argv.each do |file|
|
||||||
puts IRB::Color.colorize_code File.read(file)
|
puts IRB::Color.colorize_code File.read(file)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user