mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
cmd/list: support using --full-name
with --installed-on-request
et al.
Fixes https://github.com/Homebrew/brew/issues/18908#issuecomment-2532926860.
This commit is contained in:
parent
29e9087537
commit
a50e15e43c
@ -75,10 +75,7 @@ module Homebrew
|
|||||||
conflicts "--versions", flag
|
conflicts "--versions", flag
|
||||||
conflicts "--pinned", flag
|
conflicts "--pinned", flag
|
||||||
end
|
end
|
||||||
["--versions", "--pinned",
|
["--versions", "--pinned", "-l", "-r", "-t"].each do |flag|
|
||||||
"--installed-on-request", "--installed-as-dependency",
|
|
||||||
"--poured-from-bottle", "--built-from-source",
|
|
||||||
"-l", "-r", "-t"].each do |flag|
|
|
||||||
conflicts "--full-name", flag
|
conflicts "--full-name", flag
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -87,7 +84,9 @@ module Homebrew
|
|||||||
|
|
||||||
sig { override.void }
|
sig { override.void }
|
||||||
def run
|
def run
|
||||||
if args.full_name?
|
if args.full_name? &&
|
||||||
|
!(args.installed_on_request? || args.installed_as_dependency? ||
|
||||||
|
args.poured_from_bottle? || args.built_from_source?)
|
||||||
unless args.cask?
|
unless args.cask?
|
||||||
formula_names = args.no_named? ? Formula.installed : args.named.to_resolved_formulae
|
formula_names = args.no_named? ? Formula.installed : args.named.to_resolved_formulae
|
||||||
full_formula_names = formula_names.map(&:full_name).sort(&tap_and_name_comparison)
|
full_formula_names = formula_names.map(&:full_name).sort(&tap_and_name_comparison)
|
||||||
@ -125,6 +124,8 @@ module Homebrew
|
|||||||
|
|
||||||
formulae = if args.t?
|
formulae = if args.t?
|
||||||
Formula.installed.sort_by { |formula| test("M", formula.rack) }.reverse!
|
Formula.installed.sort_by { |formula| test("M", formula.rack) }.reverse!
|
||||||
|
elsif args.full_name?
|
||||||
|
Formula.installed.sort { |a, b| tap_and_name_comparison.call(a.full_name, b.full_name) }
|
||||||
else
|
else
|
||||||
Formula.installed.sort
|
Formula.installed.sort
|
||||||
end
|
end
|
||||||
@ -139,10 +140,11 @@ module Homebrew
|
|||||||
statuses << "built from source" if args.built_from_source? && !tab.poured_from_bottle
|
statuses << "built from source" if args.built_from_source? && !tab.poured_from_bottle
|
||||||
next if statuses.empty?
|
next if statuses.empty?
|
||||||
|
|
||||||
|
name = args.full_name? ? formula.full_name : formula.name
|
||||||
if flags.count > 1
|
if flags.count > 1
|
||||||
puts "#{formula.name}: #{statuses.join(", ")}"
|
puts "#{name}: #{statuses.join(", ")}"
|
||||||
else
|
else
|
||||||
puts formula.name
|
puts name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elsif args.no_named?
|
elsif args.no_named?
|
||||||
|
@ -1304,15 +1304,15 @@ _brew_linkage() {
|
|||||||
# brew list
|
# brew list
|
||||||
_brew_list() {
|
_brew_list() {
|
||||||
_arguments \
|
_arguments \
|
||||||
'(--cask --versions --pinned -l --full-name)--built-from-source[List the formulae compiled from source]' \
|
'(--cask --versions --pinned -l)--built-from-source[List the formulae compiled from source]' \
|
||||||
'--debug[Display any debugging information]' \
|
'--debug[Display any debugging information]' \
|
||||||
'(--versions --pinned --installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source -l -r -t)--full-name[Print formulae with fully-qualified names. Unless `--full-name`, `--versions` or `--pinned` are passed, other options (i.e. `-1`, `-l`, `-r` and `-t`) are passed to `ls`(1) which produces the actual output]' \
|
'(--versions --pinned -l -r -t)--full-name[Print formulae with fully-qualified names. Unless `--full-name`, `--versions` or `--pinned` are passed, other options (i.e. `-1`, `-l`, `-r` and `-t`) are passed to `ls`(1) which produces the actual output]' \
|
||||||
'--help[Show this message]' \
|
'--help[Show this message]' \
|
||||||
'(--cask --versions --pinned -l --full-name)--installed-as-dependency[List the formulae installed as dependencies]' \
|
'(--cask --versions --pinned -l)--installed-as-dependency[List the formulae installed as dependencies]' \
|
||||||
'(--cask --versions --pinned -l --full-name)--installed-on-request[List the formulae installed on request]' \
|
'(--cask --versions --pinned -l)--installed-on-request[List the formulae installed on request]' \
|
||||||
'(--cask --pinned)--multiple[Only show formulae with multiple versions installed]' \
|
'(--cask --pinned)--multiple[Only show formulae with multiple versions installed]' \
|
||||||
'(--cask --multiple --installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source -1 -l -r -t --full-name)--pinned[List only pinned formulae, or only the specified (pinned) formulae if formula are provided. See also `pin`, `unpin`]' \
|
'(--cask --multiple --installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source -1 -l -r -t --full-name)--pinned[List only pinned formulae, or only the specified (pinned) formulae if formula are provided. See also `pin`, `unpin`]' \
|
||||||
'(--cask --versions --pinned -l --full-name)--poured-from-bottle[List the formulae installed from a bottle]' \
|
'(--cask --versions --pinned -l)--poured-from-bottle[List the formulae installed from a bottle]' \
|
||||||
'--quiet[Make some output more quiet]' \
|
'--quiet[Make some output more quiet]' \
|
||||||
'--verbose[Make some output more verbose]' \
|
'--verbose[Make some output more verbose]' \
|
||||||
'(--installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source -1 -l -r -t --full-name)--versions[Show the version number for installed formulae, or only the specified formulae if formula are provided]' \
|
'(--installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source -1 -l -r -t --full-name)--versions[Show the version number for installed formulae, or only the specified formulae if formula are provided]' \
|
||||||
@ -1389,15 +1389,15 @@ _brew_log() {
|
|||||||
# brew ls
|
# brew ls
|
||||||
_brew_ls() {
|
_brew_ls() {
|
||||||
_arguments \
|
_arguments \
|
||||||
'(--cask --versions --pinned -l --full-name)--built-from-source[List the formulae compiled from source]' \
|
'(--cask --versions --pinned -l)--built-from-source[List the formulae compiled from source]' \
|
||||||
'--debug[Display any debugging information]' \
|
'--debug[Display any debugging information]' \
|
||||||
'(--versions --pinned --installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source -l -r -t)--full-name[Print formulae with fully-qualified names. Unless `--full-name`, `--versions` or `--pinned` are passed, other options (i.e. `-1`, `-l`, `-r` and `-t`) are passed to `ls`(1) which produces the actual output]' \
|
'(--versions --pinned -l -r -t)--full-name[Print formulae with fully-qualified names. Unless `--full-name`, `--versions` or `--pinned` are passed, other options (i.e. `-1`, `-l`, `-r` and `-t`) are passed to `ls`(1) which produces the actual output]' \
|
||||||
'--help[Show this message]' \
|
'--help[Show this message]' \
|
||||||
'(--cask --versions --pinned -l --full-name)--installed-as-dependency[List the formulae installed as dependencies]' \
|
'(--cask --versions --pinned -l)--installed-as-dependency[List the formulae installed as dependencies]' \
|
||||||
'(--cask --versions --pinned -l --full-name)--installed-on-request[List the formulae installed on request]' \
|
'(--cask --versions --pinned -l)--installed-on-request[List the formulae installed on request]' \
|
||||||
'(--cask --pinned)--multiple[Only show formulae with multiple versions installed]' \
|
'(--cask --pinned)--multiple[Only show formulae with multiple versions installed]' \
|
||||||
'(--cask --multiple --installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source -1 -l -r -t --full-name)--pinned[List only pinned formulae, or only the specified (pinned) formulae if formula are provided. See also `pin`, `unpin`]' \
|
'(--cask --multiple --installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source -1 -l -r -t --full-name)--pinned[List only pinned formulae, or only the specified (pinned) formulae if formula are provided. See also `pin`, `unpin`]' \
|
||||||
'(--cask --versions --pinned -l --full-name)--poured-from-bottle[List the formulae installed from a bottle]' \
|
'(--cask --versions --pinned -l)--poured-from-bottle[List the formulae installed from a bottle]' \
|
||||||
'--quiet[Make some output more quiet]' \
|
'--quiet[Make some output more quiet]' \
|
||||||
'--verbose[Make some output more verbose]' \
|
'--verbose[Make some output more verbose]' \
|
||||||
'(--installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source -1 -l -r -t --full-name)--versions[Show the version number for installed formulae, or only the specified formulae if formula are provided]' \
|
'(--installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source -1 -l -r -t --full-name)--versions[Show the version number for installed formulae, or only the specified formulae if formula are provided]' \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user