changing ask_input function to lambda

This commit is contained in:
thibhero 2025-02-07 14:39:22 -05:00
parent 1992bb44b2
commit 354849895a

View File

@ -180,9 +180,7 @@ module Homebrew
odisabled "brew install --env", "`env :std` in specific formula files" odisabled "brew install --env", "`env :std` in specific formula files"
end end
sig { returns(NilClass) } ask_input = lambda {
def ask_input
ohai "Do you want to proceed with the installation? [Y/y/yes/N/n]" ohai "Do you want to proceed with the installation? [Y/y/yes/N/n]"
accepted_inputs = %w[y yes] accepted_inputs = %w[y yes]
declined_inputs = %w[n no] declined_inputs = %w[n no]
@ -197,7 +195,7 @@ module Homebrew
puts "Invalid input. Please enter 'Y', 'y', or 'yes' to proceed, or 'N' to abort." puts "Invalid input. Please enter 'Y', 'y', or 'yes' to proceed, or 'N' to abort."
end end
end end
end }
args.named.each do |name| args.named.each do |name|
if (tap_with_name = Tap.with_formula_name(name)) if (tap_with_name = Tap.with_formula_name(name))
@ -351,7 +349,7 @@ module Homebrew
puts "Formulae: #{sized_formulae.join(", ")}\n\n" puts "Formulae: #{sized_formulae.join(", ")}\n\n"
puts "Download Size: #{disk_usage_readable(total_download_size)}" if total_download_size puts "Download Size: #{disk_usage_readable(total_download_size)}" if total_download_size
puts "Install Size: #{disk_usage_readable(total_installed_size)}\n" if total_installed_size puts "Install Size: #{disk_usage_readable(total_installed_size)}\n" if total_installed_size
ask_input ask_input.call
end end
Install.install_formulae( Install.install_formulae(