File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ ruby -run -e touch -- [OPTION] FILE
33
33
ruby -run -e wait_writable -- [OPTION] FILE
34
34
ruby -run -e mkmf -- [OPTION] EXTNAME [OPTION]
35
35
ruby -run -e httpd -- [OPTION] [DocumentRoot]
36
+ ruby -run -e colorize -- FILE
36
37
ruby -run -e help [COMMAND]
37
38
```
38
39
Original file line number Diff line number Diff line change 23
23
# ruby -run -e wait_writable -- [OPTION] FILE
24
24
# ruby -run -e mkmf -- [OPTION] EXTNAME [OPTION]
25
25
# ruby -run -e httpd -- [OPTION] [DocumentRoot]
26
+ # ruby -run -e colorize -- FILE
26
27
# ruby -run -e help [COMMAND]
27
28
28
29
require "fileutils"
@@ -354,6 +355,25 @@ def httpd
354
355
end
355
356
end
356
357
358
+ ##
359
+ # Colorize ruby code.
360
+ #
361
+ # ruby -run -e colorize -- FILE
362
+ #
363
+
364
+ def colorize
365
+ begin
366
+ require "irb/color"
367
+ rescue LoadError
368
+ raise "colorize requires irb 1.1.0 or later"
369
+ end
370
+ setup do |argv , |
371
+ argv . each do |file |
372
+ puts IRB ::Color . colorize_code File . read ( file )
373
+ end
374
+ end
375
+ end
376
+
357
377
##
358
378
# Display help message.
359
379
#
You can’t perform that action at this time.
0 commit comments