Getting input of user and proceeding the different output
This commit is contained in:
parent
87492f8fbe
commit
e47bdd9ad0
@ -305,6 +305,7 @@ module Homebrew
|
|||||||
Install.perform_preinstall_checks_once
|
Install.perform_preinstall_checks_once
|
||||||
Install.check_cc_argv(args.cc)
|
Install.check_cc_argv(args.cc)
|
||||||
|
|
||||||
|
# Showing dependencies and required size to install
|
||||||
if args.ask?
|
if args.ask?
|
||||||
ohai "Looking for dependencies..."
|
ohai "Looking for dependencies..."
|
||||||
installed_formulae.each do |f|
|
installed_formulae.each do |f|
|
||||||
@ -316,16 +317,28 @@ module Homebrew
|
|||||||
installed_size = bottle.installed_size
|
installed_size = bottle.installed_size
|
||||||
package.push(f, f.recursive_dependencies)
|
package.push(f, f.recursive_dependencies)
|
||||||
unless f.deps.empty?
|
unless f.deps.empty?
|
||||||
puts "Packages : #{package.join(", ")}\n\n"
|
|
||||||
f.recursive_dependencies.each do |dep|
|
f.recursive_dependencies.each do |dep|
|
||||||
bottle = dep.to_formula.bottle
|
bottle = dep.to_formula.bottle
|
||||||
bottle.fetch_tab(quiet: !args.debug?)
|
bottle.fetch_tab(quiet: !args.debug?)
|
||||||
bottle_size += bottle.bottle_size if bottle.bottle_size
|
bottle_size += bottle.bottle_size if bottle.bottle_size
|
||||||
installed_size += bottle.installed_size if bottle.installed_size
|
installed_size += bottle.installed_size if bottle.installed_size
|
||||||
end
|
end
|
||||||
puts "Bottle Size: #{disk_usage_readable(bottle_size)}" if bottle_size
|
end
|
||||||
puts "Installed Size: #{disk_usage_readable(installed_size)}" if installed_size
|
puts "Packages : #{package.join(", ")}\n\n"
|
||||||
return
|
puts "Bottle Size: #{disk_usage_readable(bottle_size)}" if bottle_size
|
||||||
|
puts "Installed Size: #{disk_usage_readable(installed_size)}\n\n" if installed_size
|
||||||
|
ohai "Do you want to proceed with the installation? [Y/y/yes/N/n]"
|
||||||
|
loop do
|
||||||
|
result = STDIN.gets.chomp.strip.downcase
|
||||||
|
|
||||||
|
if result == "y" || result == "yes"
|
||||||
|
puts "Proceeding with installation..."
|
||||||
|
break
|
||||||
|
elsif result == "n"
|
||||||
|
return
|
||||||
|
else
|
||||||
|
puts "Invalid input. Please enter 'Y', 'y', or 'yes' to proceed, or 'N' to abort."
|
||||||
|
end
|
||||||
end
|
end
|
||||||
rescue RuntimeError => e
|
rescue RuntimeError => e
|
||||||
odebug e
|
odebug e
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user