diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-07 02:57:15 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-07 02:57:15 +0000 |
commit | 48dad9e3242087ad95dc061ee97849fe462db847 (patch) | |
tree | 3b2026da92c4cc115afaaa44f76912fd3204ade9 | |
parent | 060ac5ca43e80c474a87176577f1139976d44a7b (diff) | |
download | ruby-48dad9e3242087ad95dc061ee97849fe462db847.tar.gz ruby-48dad9e3242087ad95dc061ee97849fe462db847.tar.xz ruby-48dad9e3242087ad95dc061ee97849fe462db847.zip |
* runruby.rb: added --precommand and --show options.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rwxr-xr-x | runruby.rb | 18 |
2 files changed, 19 insertions, 3 deletions
@@ -1,3 +1,7 @@ +Sat Feb 7 11:57:13 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * runruby.rb: added --precommand and --show options. + Sat Feb 7 11:44:06 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> * lib/mkmf.rb (have_header): needs dependent headers if trying to diff --git a/runruby.rb b/runruby.rb index c43978404..900469c1d 100755 --- a/runruby.rb +++ b/runruby.rb @@ -1,6 +1,8 @@ #!./miniruby pure = true +show = false +precommand = [] while arg = ARGV[0] break ARGV.shift if arg == '--' /\A--([-\w]+)(?:=(.*))?\z/ =~ arg or break @@ -16,7 +18,13 @@ while arg = ARGV[0] when re =~ "pure" pure = (value != "no") when re =~ "debugger" - debugger = value ? (value.split unless value == "no") : %w"gdb --args" + require 'shellwords' + precommand.concat(value ? (Shellwords.shellwords(value) unless value == "no") : %w"gdb --args") + when re =~ "precommand" + require 'shellwords' + precommand.concat(Shellwords.shellwords(value)) + when re =~ "show" + show = true else break end @@ -72,8 +80,12 @@ ENV.update env cmd = [ruby] cmd << "-rpurelib.rb" if pure cmd.concat(ARGV) -cmd.unshift(*debugger) if debugger +cmd.unshift(*precommand) unless precommand.empty? -#require 'shellwords'; puts Shellwords.join(env.map {|k,v| "#{k}=#{v}" } + cmd) +if show + require 'shellwords' + env.each {|k,v| puts "#{k}=#{v}"} + puts Shellwords.join(cmd) +end exec(*cmd) |