diff options
| author | Mike McQuaid | 2017-04-17 15:06:24 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2017-04-17 15:06:48 +0100 |
| commit | 5a2c91dbc2cb935ecfc42dc72975a3e721f12154 (patch) | |
| tree | f93e70c0b55aed37b2f0b781df3ed9a1fd152762 /Library | |
| parent | d950573f798d8a12545e78d2800b4b07a5c4c097 (diff) | |
| download | brew-5a2c91dbc2cb935ecfc42dc72975a3e721f12154.tar.bz2 | |
uses: allow checking deleted formulae.
This is useful for seeing when formulae are deleted if they are going to
leave behind any formulae that depend on them.
As a result, if there are any formulae returned return a non-zero/failed
exit status.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/uses.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb index b1122c90a..bab174184 100644 --- a/Library/Homebrew/cmd/uses.rb +++ b/Library/Homebrew/cmd/uses.rb @@ -28,7 +28,16 @@ module Homebrew def uses raise FormulaUnspecifiedError if ARGV.named.empty? - used_formulae = ARGV.formulae + used_formulae_missing = false + used_formulae = begin + ARGV.formulae + rescue FormulaUnavailableError => e + opoo e + used_formulae_missing = true + # If the formula doesn't exist: fake the needed formula object name. + ARGV.named.map { |name| OpenStruct.new name: name, full_name: name } + end + formulae = ARGV.include?("--installed") ? Formula.installed : Formula recursive = ARGV.flag? "--recursive" includes = [] @@ -115,5 +124,6 @@ module Homebrew return if uses.empty? puts Formatter.columns(uses.map(&:full_name)) + odie "Missing formulae should not have dependents!" if used_formulae_missing end end |
