From c8a9cfa4d0165348ad1b3c7e735cb97179a3be8f Mon Sep 17 00:00:00 2001 From: thibhero Date: Thu, 6 Feb 2025 09:07:55 -0500 Subject: [PATCH] Add support for the HOMEBREW_ASK environment variable --- Library/Homebrew/cmd/install.rb | 2 +- Library/Homebrew/env_config.rb | 4 ++++ Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 1a083b93c9..7649f52855 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -306,7 +306,7 @@ module Homebrew Install.check_cc_argv(args.cc) # Showing dependencies and required size to install - if args.ask? + if args.ask? || !Homebrew::EnvConfig.ask? ohai "Looking for dependencies..." package = [] bottle_size = 0 diff --git a/Library/Homebrew/env_config.rb b/Library/Homebrew/env_config.rb index 5a1e68207f..f91b3ac786 100644 --- a/Library/Homebrew/env_config.rb +++ b/Library/Homebrew/env_config.rb @@ -500,6 +500,10 @@ module Homebrew "of build provenance for bottles from homebrew-core.", boolean: true, }, + HOMEBREW_ASK: { + description: "If set, pass `--ask`to all formula install commands.", + boolean: true, + }, SUDO_ASKPASS: { description: "If set, pass the `-A` option when calling `sudo`(8).", }, diff --git a/Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi b/Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi index bc71d5feb7..a6a0e07bc0 100644 --- a/Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi +++ b/Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi @@ -315,5 +315,8 @@ module Homebrew::EnvConfig sig { returns(T::Boolean) } def verify_attestations?; end + + sig { returns(T::Boolean) } + def ask?; end end end