Skip to content

Add --console #638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/rake/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
require_relative "thread_history_display"
require_relative "trace_output"
require_relative "win32"
require_relative "console"

module Rake

Expand Down Expand Up @@ -644,6 +645,9 @@ def standard_rake_options # :nodoc:
options.ignore_deprecate = true
}
],
["--console", "-c", "Start an interactive Rake console (IRB)", lambda { |value|
Console.start
}],
])
end

Expand Down
14 changes: 14 additions & 0 deletions lib/rake/console.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true
module Rake
module Console
def self.start
require "irb"

puts "Rake console, version #{Rake::VERSION}"
Rake.application.load_rakefile
ARGV.clear
IRB.start
exit
end
end
end