mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Add brew install --as-dependency
This option avoids needing to immediately use `brew tab --no-installed-on-request` when manually installing a dependency.
This commit is contained in:
parent
7ddc4b0196
commit
e41a1f6d8a
@ -104,6 +104,9 @@ module Homebrew
|
||||
[:switch, "--skip-link", {
|
||||
description: "Install but skip linking the keg into the prefix.",
|
||||
}],
|
||||
[:switch, "--as-dependency", {
|
||||
description: "Install but mark as installed as a dependency and not installed on request.",
|
||||
}],
|
||||
[:flag, "--bottle-arch=", {
|
||||
depends_on: "--build-bottle",
|
||||
description: "Optimise bottles for the specified architecture rather than the oldest " \
|
||||
@ -311,6 +314,8 @@ module Homebrew
|
||||
|
||||
Install.install_formulae(
|
||||
installed_formulae,
|
||||
installed_on_request: !args.as_dependency?,
|
||||
installed_as_dependency: args.as_dependency?,
|
||||
build_bottle: args.build_bottle?,
|
||||
force_bottle: args.force_bottle?,
|
||||
bottle_arch: args.bottle_arch,
|
||||
@ -336,7 +341,7 @@ module Homebrew
|
||||
Upgrade.check_installed_dependents(
|
||||
installed_formulae,
|
||||
flags: args.flags_only,
|
||||
installed_on_request: args.named.present?,
|
||||
installed_on_request: !args.as_dependency?,
|
||||
force_bottle: args.force_bottle?,
|
||||
build_from_source_formulae: args.build_from_source_formulae,
|
||||
interactive: args.interactive?,
|
||||
|
@ -233,6 +233,8 @@ module Homebrew
|
||||
|
||||
def install_formulae(
|
||||
formulae_to_install,
|
||||
installed_on_request: true,
|
||||
installed_as_dependency: false,
|
||||
build_bottle: false,
|
||||
force_bottle: false,
|
||||
bottle_arch: nil,
|
||||
@ -261,8 +263,8 @@ module Homebrew
|
||||
formula_installer = FormulaInstaller.new(
|
||||
formula,
|
||||
options: build_options.used_options,
|
||||
installed_on_request: true,
|
||||
installed_as_dependency: false,
|
||||
installed_on_request:,
|
||||
installed_as_dependency:,
|
||||
build_bottle:,
|
||||
force_bottle:,
|
||||
bottle_arch:,
|
||||
|
@ -20,6 +20,9 @@ class Homebrew::Cmd::InstallCmd::Args < Homebrew::CLI::Args
|
||||
sig { returns(T.nilable(String)) }
|
||||
def appdir; end
|
||||
|
||||
sig { returns(T::Boolean) }
|
||||
def as_dependency?; end
|
||||
|
||||
sig { returns(T::Boolean) }
|
||||
def ask?; end
|
||||
|
||||
|
@ -1402,6 +1402,7 @@ _brew_instal() {
|
||||
--HEAD
|
||||
--adopt
|
||||
--appdir
|
||||
--as-dependency
|
||||
--ask
|
||||
--audio-unit-plugindir
|
||||
--binaries
|
||||
@ -1467,6 +1468,7 @@ _brew_install() {
|
||||
--HEAD
|
||||
--adopt
|
||||
--appdir
|
||||
--as-dependency
|
||||
--ask
|
||||
--audio-unit-plugindir
|
||||
--binaries
|
||||
|
@ -944,6 +944,7 @@ __fish_brew_complete_arg 'info; and not __fish_seen_argument -l formula -l formu
|
||||
__fish_brew_complete_arg 'instal' -l HEAD -d 'If formula defines it, install the HEAD version, aka. main, trunk, unstable, master'
|
||||
__fish_brew_complete_arg 'instal' -l adopt -d 'Adopt existing artifacts in the destination that are identical to those being installed. Cannot be combined with `--force`'
|
||||
__fish_brew_complete_arg 'instal' -l appdir -d 'Target location for Applications (default: `/Applications`)'
|
||||
__fish_brew_complete_arg 'instal' -l as-dependency -d 'Install but mark as installed as a dependency and not installed on request'
|
||||
__fish_brew_complete_arg 'instal' -l ask -d 'Ask for confirmation before downloading and installing formulae. Print bottles and dependencies download size and install size'
|
||||
__fish_brew_complete_arg 'instal' -l audio-unit-plugindir -d 'Target location for Audio Unit Plugins (default: `~/Library/Audio/Plug-Ins/Components`)'
|
||||
__fish_brew_complete_arg 'instal' -l binaries -d 'Disable/enable linking of helper executables (default: enabled)'
|
||||
@ -1000,6 +1001,7 @@ __fish_brew_complete_cmd 'install' 'Install a formula or cask'
|
||||
__fish_brew_complete_arg 'install' -l HEAD -d 'If formula defines it, install the HEAD version, aka. main, trunk, unstable, master'
|
||||
__fish_brew_complete_arg 'install' -l adopt -d 'Adopt existing artifacts in the destination that are identical to those being installed. Cannot be combined with `--force`'
|
||||
__fish_brew_complete_arg 'install' -l appdir -d 'Target location for Applications (default: `/Applications`)'
|
||||
__fish_brew_complete_arg 'install' -l as-dependency -d 'Install but mark as installed as a dependency and not installed on request'
|
||||
__fish_brew_complete_arg 'install' -l ask -d 'Ask for confirmation before downloading and installing formulae. Print bottles and dependencies download size and install size'
|
||||
__fish_brew_complete_arg 'install' -l audio-unit-plugindir -d 'Target location for Audio Unit Plugins (default: `~/Library/Audio/Plug-Ins/Components`)'
|
||||
__fish_brew_complete_arg 'install' -l binaries -d 'Disable/enable linking of helper executables (default: enabled)'
|
||||
|
@ -1187,6 +1187,7 @@ _brew_instal() {
|
||||
'(--cask)--HEAD[If formula defines it, install the HEAD version, aka. main, trunk, unstable, master]' \
|
||||
'(--formula --force)--adopt[Adopt existing artifacts in the destination that are identical to those being installed. Cannot be combined with `--force`]' \
|
||||
'(--formula)--appdir[Target location for Applications (default: `/Applications`)]' \
|
||||
'(--cask)--as-dependency[Install but mark as installed as a dependency and not installed on request]' \
|
||||
'(--cask)--ask[Ask for confirmation before downloading and installing formulae. Print bottles and dependencies download size and install size]' \
|
||||
'(--formula)--audio-unit-plugindir[Target location for Audio Unit Plugins (default: `~/Library/Audio/Plug-Ins/Components`)]' \
|
||||
'(--formula)--binaries[Disable/enable linking of helper executables (default: enabled)]' \
|
||||
@ -1237,7 +1238,7 @@ _brew_instal() {
|
||||
'(--casks --binaries --require-sha --quarantine --adopt --skip-cask-deps --zap --appdir --keyboard-layoutdir --colorpickerdir --prefpanedir --qlplugindir --mdimporterdir --dictionarydir --fontdir --servicedir --input-methoddir --internet-plugindir --audio-unit-plugindir --vst-plugindir --vst3-plugindir --screen-saverdir --language)--formula[Treat all named arguments as formulae]' \
|
||||
'*::formula:__brew_formulae' \
|
||||
- cask \
|
||||
'(--formulae --env --ignore-dependencies --only-dependencies --cc --build-from-source --force-bottle --include-test --HEAD --fetch-HEAD --keep-tmp --debug-symbols --build-bottle --skip-post-install --skip-link --bottle-arch --interactive --git --overwrite --ask)--cask[Treat all named arguments as casks]' \
|
||||
'(--formulae --env --ignore-dependencies --only-dependencies --cc --build-from-source --force-bottle --include-test --HEAD --fetch-HEAD --keep-tmp --debug-symbols --build-bottle --skip-post-install --skip-link --as-dependency --bottle-arch --interactive --git --overwrite --ask)--cask[Treat all named arguments as casks]' \
|
||||
'*::cask:__brew_casks'
|
||||
}
|
||||
|
||||
@ -1247,6 +1248,7 @@ _brew_install() {
|
||||
'(--cask)--HEAD[If formula defines it, install the HEAD version, aka. main, trunk, unstable, master]' \
|
||||
'(--formula --force)--adopt[Adopt existing artifacts in the destination that are identical to those being installed. Cannot be combined with `--force`]' \
|
||||
'(--formula)--appdir[Target location for Applications (default: `/Applications`)]' \
|
||||
'(--cask)--as-dependency[Install but mark as installed as a dependency and not installed on request]' \
|
||||
'(--cask)--ask[Ask for confirmation before downloading and installing formulae. Print bottles and dependencies download size and install size]' \
|
||||
'(--formula)--audio-unit-plugindir[Target location for Audio Unit Plugins (default: `~/Library/Audio/Plug-Ins/Components`)]' \
|
||||
'(--formula)--binaries[Disable/enable linking of helper executables (default: enabled)]' \
|
||||
@ -1297,7 +1299,7 @@ _brew_install() {
|
||||
'(--casks --binaries --require-sha --quarantine --adopt --skip-cask-deps --zap --appdir --keyboard-layoutdir --colorpickerdir --prefpanedir --qlplugindir --mdimporterdir --dictionarydir --fontdir --servicedir --input-methoddir --internet-plugindir --audio-unit-plugindir --vst-plugindir --vst3-plugindir --screen-saverdir --language)--formula[Treat all named arguments as formulae]' \
|
||||
'*::formula:__brew_formulae' \
|
||||
- cask \
|
||||
'(--formulae --env --ignore-dependencies --only-dependencies --cc --build-from-source --force-bottle --include-test --HEAD --fetch-HEAD --keep-tmp --debug-symbols --build-bottle --skip-post-install --skip-link --bottle-arch --interactive --git --overwrite --ask)--cask[Treat all named arguments as casks]' \
|
||||
'(--formulae --env --ignore-dependencies --only-dependencies --cc --build-from-source --force-bottle --include-test --HEAD --fetch-HEAD --keep-tmp --debug-symbols --build-bottle --skip-post-install --skip-link --as-dependency --bottle-arch --interactive --git --overwrite --ask)--cask[Treat all named arguments as casks]' \
|
||||
'*::cask:__brew_casks'
|
||||
}
|
||||
|
||||
|
@ -835,6 +835,10 @@ upgrade *`formula`* if it is already installed but outdated.
|
||||
|
||||
: Install but skip linking the keg into the prefix.
|
||||
|
||||
`--as-dependency`
|
||||
|
||||
: Install but mark as installed as a dependency and not installed on request.
|
||||
|
||||
`--bottle-arch`
|
||||
|
||||
: Optimise bottles for the specified architecture rather than the oldest
|
||||
|
@ -520,6 +520,9 @@ Install but skip any post\-install steps\.
|
||||
\fB\-\-skip\-link\fP
|
||||
Install but skip linking the keg into the prefix\.
|
||||
.TP
|
||||
\fB\-\-as\-dependency\fP
|
||||
Install but mark as installed as a dependency and not installed on request\.
|
||||
.TP
|
||||
\fB\-\-bottle\-arch\fP
|
||||
Optimise bottles for the specified architecture rather than the oldest architecture supported by the version of macOS the bottles are built on\.
|
||||
.TP
|
||||
|
Loading…
x
Reference in New Issue
Block a user