list: fix exit code for --verbose and --pinned

`brew list --verbose <formulae>` lists only those kegs that
are installed and exits with 0 if all <formulae> installed.
If one or more formulae from <formulae> are not installed, the
command lists only installed versions and exits with 1.

`brew --pinned formula` exits with 1 if formula is not pinned.

Fixes #1172
This commit is contained in:
Uladzislau Shablinski 2016-10-02 12:18:07 +03:00
parent 4b5aac07f0
commit db478fb7b2

View File

@ -106,7 +106,11 @@ module Homebrew
names = if ARGV.named.empty? names = if ARGV.named.empty?
Formula.racks Formula.racks
else else
ARGV.named.map { |n| HOMEBREW_CELLAR+n }.select(&:exist?) racks = ARGV.named.map { |n| HOMEBREW_CELLAR+n }
racks.select do |rack|
Homebrew.failed = true unless rack.exist?
rack.exist?
end
end end
if ARGV.include? "--pinned" if ARGV.include? "--pinned"
pinned_versions = {} pinned_versions = {}