summaryrefslogtreecommitdiff
path: root/lib/un.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/un.rb')
-rw-r--r--lib/un.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/un.rb b/lib/un.rb
index 208e16c761..75426ba17e 100644
--- a/lib/un.rb
+++ b/lib/un.rb
@@ -23,6 +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 help [COMMAND]
require "fileutils"
@@ -374,6 +375,25 @@ def httpd
end
##
+# Colorize ruby code.
+#
+# ruby -run -e colorize -- FILE
+#
+
+def colorize
+ begin
+ require "irb/color"
+ rescue LoadError
+ raise "colorize requires irb 1.1.0 or later"
+ end
+ setup do |argv, |
+ argv.each do |file|
+ puts IRB::Color.colorize_code File.read(file)
+ end
+ end
+end
+
+##
# Display help message.
#
# ruby -run -e help [COMMAND]