Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/list: -t and -r support for some long options #18425

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Library/Homebrew/cmd/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@
conflicts "--cask", flag
conflicts "--versions", flag
conflicts "--pinned", flag
conflicts "-l", flag
end
["-1", "-l", "-r", "-t"].each do |flag|
conflicts "--versions", flag
conflicts "--pinned", flag
end
["--versions", "--pinned",
"---installed-on-request", "--installed-as-dependency",
"--installed-on-request", "--installed-as-dependency",
"--poured-from-bottle", "--built-from-source",
"-l", "-r", "-t"].each do |flag|
conflicts "--full-name", flag
Expand Down Expand Up @@ -122,7 +123,13 @@

raise UsageError, "Cannot use #{flags.join(", ")} with formula arguments." unless args.no_named?

Formula.installed.sort.each do |formula|
formulae = if args.t?

Check warning on line 126 in Library/Homebrew/cmd/list.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cmd/list.rb#L126

Added line #L126 was not covered by tests
Formula.installed.sort_by { |formula| test("M", formula.rack) }.reverse!
else
Formula.installed.sort
end
formulae.reverse! if args.r?
formulae.each do |formula|

Check warning on line 132 in Library/Homebrew/cmd/list.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cmd/list.rb#L132

Added line #L132 was not covered by tests
tab = Tab.for_formula(formula)

statuses = []
Expand Down
20 changes: 10 additions & 10 deletions completions/zsh/_brew
Original file line number Diff line number Diff line change
Expand Up @@ -1287,15 +1287,15 @@ _brew_linkage() {
# brew list
_brew_list() {
_arguments \
'(--cask --versions --pinned --full-name)--built-from-source[List the formulae compiled from source]' \
'(--cask --versions --pinned --l --full-name)--built-from-source[List the formulae compiled from source]' \
'--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 --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]' \
'--help[Show this message]' \
'(--cask --versions --pinned --full-name)--installed-as-dependency[List the formulae installed as dependencies]' \
'(--cask --versions --pinned)--installed-on-request[List the formulae installed on request]' \
'(--cask --versions --pinned --l --full-name)--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 --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 --versions --pinned --full-name)--poured-from-bottle[List the formulae installed from a bottle]' \
'(--cask --versions --pinned --l --full-name)--poured-from-bottle[List the formulae installed from a bottle]' \
'--quiet[Make some output more quiet]' \
'--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]' \
Expand Down Expand Up @@ -1372,15 +1372,15 @@ _brew_log() {
# brew ls
_brew_ls() {
_arguments \
'(--cask --versions --pinned --full-name)--built-from-source[List the formulae compiled from source]' \
'(--cask --versions --pinned --l --full-name)--built-from-source[List the formulae compiled from source]' \
'--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 --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]' \
'--help[Show this message]' \
'(--cask --versions --pinned --full-name)--installed-as-dependency[List the formulae installed as dependencies]' \
'(--cask --versions --pinned)--installed-on-request[List the formulae installed on request]' \
'(--cask --versions --pinned --l --full-name)--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 --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 --versions --pinned --full-name)--poured-from-bottle[List the formulae installed from a bottle]' \
'(--cask --versions --pinned --l --full-name)--poured-from-bottle[List the formulae installed from a bottle]' \
'--quiet[Make some output more quiet]' \
'--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]' \
Expand Down
Loading