Skip to content

Commit

Permalink
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tool/jt.rb
Original file line number Diff line number Diff line change
@@ -250,9 +250,14 @@ def e(*args)
run '-e', args.join(' ')
end

def print(*args)
def command_puts(*args)
e 'puts begin', *args, 'end'
end
alias_method :command_print, :command_puts

def command_p(*args)
e 'p begin', *args, 'end'
end

def test_mri(*args)
env_vars = {
@@ -426,10 +431,13 @@ def main(args)

commands = Commands.public_instance_methods(false).map(&:to_s)

abort "no command matched #{args.first.inspect}" unless commands.include?(args.first)
command, *rest = args
command = "command_#{command}" if %w[p puts print].include? command

abort "no command matched #{command.inspect}" unless commands.include?(command)

begin
send(*args)
send(command, *rest)
rescue
puts "Error during command: #{args*' '}"
raise $!

0 comments on commit efe1e06

Please sign in to comment.