mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Improve brew install --quiet
- Suppress (some more) warnings when doing `brew install --quiet` - Clarify `man brew` output that we don't suppress all warnings for all commands with `--quiet` While I was doing this I noticed references to the (soon to be deprecated) `brew switch` so: - remove these references in `install` output - remove a reference in the documentation - add a comment to remind me to deprecate `brew diy`, too Fixes #9179
This commit is contained in:
parent
f00e094884
commit
caae165eb2
@ -100,7 +100,7 @@ module Homebrew
|
|||||||
def self.global_options
|
def self.global_options
|
||||||
[
|
[
|
||||||
["-d", "--debug", "Display any debugging information."],
|
["-d", "--debug", "Display any debugging information."],
|
||||||
["-q", "--quiet", "Suppress any warnings."],
|
["-q", "--quiet", "Make some output more quiet."],
|
||||||
["-v", "--verbose", "Make some output more verbose."],
|
["-v", "--verbose", "Make some output more verbose."],
|
||||||
["-h", "--help", "Show this message."],
|
["-h", "--help", "Show this message."],
|
||||||
]
|
]
|
||||||
|
@ -204,7 +204,7 @@ module Homebrew
|
|||||||
EOS
|
EOS
|
||||||
elsif args.only_dependencies?
|
elsif args.only_dependencies?
|
||||||
installed_formulae << f
|
installed_formulae << f
|
||||||
else
|
elsif !args.quiet?
|
||||||
opoo <<~EOS
|
opoo <<~EOS
|
||||||
#{f.full_name} #{f.pkg_version} is already installed and up-to-date
|
#{f.full_name} #{f.pkg_version} is already installed and up-to-date
|
||||||
To reinstall #{f.pkg_version}, run `brew reinstall #{f.name}`
|
To reinstall #{f.pkg_version}, run `brew reinstall #{f.name}`
|
||||||
@ -224,11 +224,14 @@ module Homebrew
|
|||||||
msg = "#{f.full_name} #{installed_version} is already installed"
|
msg = "#{f.full_name} #{installed_version} is already installed"
|
||||||
linked_not_equals_installed = f.linked_version != installed_version
|
linked_not_equals_installed = f.linked_version != installed_version
|
||||||
if f.linked? && linked_not_equals_installed
|
if f.linked? && linked_not_equals_installed
|
||||||
msg = <<~EOS
|
msg = if args.quiet?
|
||||||
|
nil
|
||||||
|
else
|
||||||
|
<<~EOS
|
||||||
#{msg}
|
#{msg}
|
||||||
The currently linked version is #{f.linked_version}
|
The currently linked version is #{f.linked_version}
|
||||||
You can use `brew switch #{f} #{installed_version}` to link this version.
|
|
||||||
EOS
|
EOS
|
||||||
|
end
|
||||||
elsif !f.linked? || f.keg_only?
|
elsif !f.linked? || f.keg_only?
|
||||||
msg = <<~EOS
|
msg = <<~EOS
|
||||||
#{msg}, it's just not linked
|
#{msg}, it's just not linked
|
||||||
@ -238,11 +241,15 @@ module Homebrew
|
|||||||
msg = nil
|
msg = nil
|
||||||
installed_formulae << f
|
installed_formulae << f
|
||||||
else
|
else
|
||||||
msg = <<~EOS
|
msg = if args.quiet?
|
||||||
|
nil
|
||||||
|
else
|
||||||
|
<<~EOS
|
||||||
#{msg} and up-to-date
|
#{msg} and up-to-date
|
||||||
To reinstall #{f.pkg_version}, run `brew reinstall #{f.name}`
|
To reinstall #{f.pkg_version}, run `brew reinstall #{f.name}`
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
end
|
||||||
opoo msg if msg
|
opoo msg if msg
|
||||||
elsif !f.any_version_installed? && old_formula = f.old_installed_formulae.first
|
elsif !f.any_version_installed? && old_formula = f.old_installed_formulae.first
|
||||||
msg = "#{old_formula.full_name} #{old_formula.any_installed_version} already installed"
|
msg = "#{old_formula.full_name} #{old_formula.any_installed_version} already installed"
|
||||||
@ -251,8 +258,10 @@ module Homebrew
|
|||||||
#{msg}, it's just not linked.
|
#{msg}, it's just not linked.
|
||||||
You can use `brew link #{old_formula.full_name}` to link this version.
|
You can use `brew link #{old_formula.full_name}` to link this version.
|
||||||
EOS
|
EOS
|
||||||
|
elsif args.quiet?
|
||||||
|
msg = nil
|
||||||
end
|
end
|
||||||
opoo msg
|
opoo msg if msg
|
||||||
elsif f.migration_needed? && !args.force?
|
elsif f.migration_needed? && !args.force?
|
||||||
# Check if the formula we try to install is the same as installed
|
# Check if the formula we try to install is the same as installed
|
||||||
# but not migrated one. If --force is passed then install anyway.
|
# but not migrated one. If --force is passed then install anyway.
|
||||||
|
@ -31,6 +31,8 @@ module Homebrew
|
|||||||
def diy
|
def diy
|
||||||
args = diy_args.parse
|
args = diy_args.parse
|
||||||
|
|
||||||
|
# odeprecated "`brew diy`"
|
||||||
|
|
||||||
path = Pathname.getwd
|
path = Pathname.getwd
|
||||||
|
|
||||||
version = args.version || detect_version(path)
|
version = args.version || detect_version(path)
|
||||||
|
@ -1384,7 +1384,7 @@ These options are applicable across multiple subcommands.
|
|||||||
Display any debugging information.
|
Display any debugging information.
|
||||||
|
|
||||||
* `-q`, `--quiet`:
|
* `-q`, `--quiet`:
|
||||||
Suppress any warnings.
|
Make some output more quiet.
|
||||||
|
|
||||||
* `-v`, `--verbose`:
|
* `-v`, `--verbose`:
|
||||||
Make some output more verbose.
|
Make some output more verbose.
|
||||||
|
@ -15,15 +15,6 @@ This can be useful if a package can't build against the version of something you
|
|||||||
|
|
||||||
And of course, you can simply `brew link <formula>` again afterwards!
|
And of course, you can simply `brew link <formula>` again afterwards!
|
||||||
|
|
||||||
## Activate a previously installed version of a formula
|
|
||||||
|
|
||||||
```sh
|
|
||||||
brew info <formula>
|
|
||||||
brew switch <formula> <version>
|
|
||||||
```
|
|
||||||
|
|
||||||
Use `brew info <formula>` to check what versions are installed but not currently activated, then `brew switch <formula> <version>` to activate the desired version. This can be useful if you would like to switch between versions of a formula.
|
|
||||||
|
|
||||||
## Install into Homebrew without formulae
|
## Install into Homebrew without formulae
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
@ -1899,7 +1899,7 @@ Display any debugging information\.
|
|||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
\fB\-q\fR, \fB\-\-quiet\fR
|
\fB\-q\fR, \fB\-\-quiet\fR
|
||||||
Suppress any warnings\.
|
Make some output more quiet\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
\fB\-v\fR, \fB\-\-verbose\fR
|
\fB\-v\fR, \fB\-\-verbose\fR
|
||||||
|
Loading…
x
Reference in New Issue
Block a user