Getting input of user and proceeding the different output

This commit is contained in:
thibhero 2025-02-05 21:20:17 -05:00
parent 87492f8fbe
commit e47bdd9ad0

View File

@ -305,6 +305,7 @@ module Homebrew
Install.perform_preinstall_checks_once
Install.check_cc_argv(args.cc)
# Showing dependencies and required size to install
if args.ask?
ohai "Looking for dependencies..."
installed_formulae.each do |f|
@ -316,16 +317,28 @@ module Homebrew
installed_size = bottle.installed_size
package.push(f, f.recursive_dependencies)
unless f.deps.empty?
puts "Packages : #{package.join(", ")}\n\n"
f.recursive_dependencies.each do |dep|
bottle = dep.to_formula.bottle
bottle.fetch_tab(quiet: !args.debug?)
bottle_size += bottle.bottle_size if bottle.bottle_size
installed_size += bottle.installed_size if bottle.installed_size
end
end
puts "Packages : #{package.join(", ")}\n\n"
puts "Bottle Size: #{disk_usage_readable(bottle_size)}" if bottle_size
puts "Installed Size: #{disk_usage_readable(installed_size)}" if installed_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
rescue RuntimeError => e
odebug e