From f0f04f0aca45b930a6d5c5f3ab139233ddffc9bc Mon Sep 17 00:00:00 2001 From: eban Date: Fri, 27 Dec 2002 16:28:10 +0000 Subject: * instruby.rb: use getopts.rb. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- instruby.rb | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/instruby.rb b/instruby.rb index 68b8bb489..5c5b0b400 100644 --- a/instruby.rb +++ b/instruby.rb @@ -6,21 +6,16 @@ include Config $:.unshift File.join(CONFIG["srcdir"], "lib") require 'fileutils' require 'shellwords' +require 'getopts' File.umask(0) -while arg = ARGV.shift - case arg - when /^--make-flags=(.*)/ - Shellwords.shellwords($1).grep(/^-[^-]*n/) {break $dryrun = true} - when "-n" - $dryrun = true - when /^-/ - else - destdir ||= arg - end +getopts("n", "make:", "make-flags:") +$dryrun = $OPT["n"] +Shellwords.shellwords($OPT["make-flags"] || "").grep(/^-[^-]*n/) do + break $dryrun = true end -destdir ||= '' +destdir = ARGV[0] || '' include FileUtils::Verbose include FileUtils::NoWrite if $dryrun -- cgit