[macruby-changes] [4643] DietRB/trunk/bin/dietrb
source_changes at macosforge.org
source_changes at macosforge.org
Fri Oct 8 03:53:05 PDT 2010
Revision: 4643
http://trac.macosforge.org/projects/ruby/changeset/4643
Author: eloy.de.enige at gmail.com
Date: 2010-10-08 03:53:04 -0700 (Fri, 08 Oct 2010)
Log Message:
-----------
Add the -r, -d, -I, and -v options to ./bin/dietrb.
From: Eloy Duran <eloy.de.enige at gmail.com>
Modified Paths:
--------------
DietRB/trunk/bin/dietrb
Modified: DietRB/trunk/bin/dietrb
===================================================================
--- DietRB/trunk/bin/dietrb 2010-10-08 10:52:56 UTC (rev 4642)
+++ DietRB/trunk/bin/dietrb 2010-10-08 10:53:04 UTC (rev 4643)
@@ -1,4 +1,20 @@
#!/usr/bin/env ruby
+unless ARGV.empty?
+ require 'optparse'
+
+ OptionParser.new do |opt|
+ bin = File.basename($0)
+ opt.banner = "Usage: #{bin} [options] [programfile] [arguments]"
+ opt.on("-r load-lib", "Loads the given library (same as `ruby -r')") { |lib| require lib }
+ opt.on("-d", "Set $DEBUG to true (same as `ruby -d')") { $DEBUG = true }
+ opt.on("-I path", "Add path to $LOAD_PATH") { |path| $LOAD_PATH.unshift(path) }
+ opt.on("-v", "--version", "Print the version of #{bin}") do
+ puts File.read(File.expand_path('../../VERSION', __FILE__))
+ exit
+ end
+ end.parse!(ARGV)
+end
+
require 'irb'
irb(self, TOPLEVEL_BINDING)
\ No newline at end of file
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101008/c3e71765/attachment.html>
More information about the macruby-changes
mailing list