summaryrefslogtreecommitdiffstats
path: root/lib/irb/extend-command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/irb/extend-command.rb')
-rw-r--r--lib/irb/extend-command.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/irb/extend-command.rb b/lib/irb/extend-command.rb
index 5cfae7ea3..2816f3511 100644
--- a/lib/irb/extend-command.rb
+++ b/lib/irb/extend-command.rb
@@ -125,9 +125,14 @@ module IRB
eval %[
def #{cmd_name}(*opts, &b)
require "#{load_file}"
+ arity = ExtendCommand::#{cmd_class}.instance_method(:execute).arity
+ args = (1..arity.abs).map {|i| "arg" + i.to_s }
+ args << "*opts" if arity < 0
+ args << "&block"
+ args = args.join(", ")
eval %[
- def #{cmd_name}(*opts, &b)
- ExtendCommand::#{cmd_class}.execute(irb_context, *opts, &b)
+ def #{cmd_name}(\#{args})
+ ExtendCommand::#{cmd_class}.execute(irb_context, \#{args})
end
]
send :#{cmd_name}, *opts, &b