mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
search: add separate flag for formulae
This commit is contained in:
parent
2b838713a2
commit
67d012afcc
@ -36,6 +36,9 @@ module Homebrew
|
||||
If no <text> is provided, list all locally available formulae (including tapped ones).
|
||||
No online search is performed.
|
||||
EOS
|
||||
switch "--formulae",
|
||||
description: "List all locally available formulae. "\
|
||||
"No online search is performed."
|
||||
switch "--casks",
|
||||
description: "List all locally available casks (including tapped ones). "\
|
||||
"No online search is performed."
|
||||
@ -65,6 +68,8 @@ module Homebrew
|
||||
|
||||
if args.remaining.empty?
|
||||
if args.casks?
|
||||
raise UsageError, "Cannot specify --formulae and --casks without an argument!" if args.formulae?
|
||||
|
||||
puts Formatter.columns(Cask::Cask.to_a.map(&:full_name).sort)
|
||||
else
|
||||
puts Formatter.columns(Formula.full_names.sort)
|
||||
@ -88,14 +93,17 @@ module Homebrew
|
||||
local_casks = search_casks(string_or_regex)
|
||||
remote_casks = remote_results[:casks]
|
||||
all_casks = local_casks + remote_casks
|
||||
print_formulae = args.formulae?
|
||||
print_casks = args.casks?
|
||||
print_formulae = print_casks = true if !print_formulae && !print_casks
|
||||
|
||||
if all_formulae.any?
|
||||
if print_formulae && all_formulae.any?
|
||||
ohai "Formulae"
|
||||
puts Formatter.columns(all_formulae)
|
||||
end
|
||||
|
||||
if all_casks.any?
|
||||
puts if all_formulae.any?
|
||||
if print_casks && all_casks.any?
|
||||
puts if args.formulae? && all_formulae.any?
|
||||
ohai "Casks"
|
||||
puts Formatter.columns(all_casks)
|
||||
end
|
||||
|
@ -425,6 +425,8 @@ search for *`text`* is extended online to `homebrew/core` and `homebrew/cask`.
|
||||
If no *`text`* is provided, list all locally available formulae (including tapped
|
||||
ones). No online search is performed.
|
||||
|
||||
* `--formulae`:
|
||||
List all locally available formulae. No online search is performed.
|
||||
* `--casks`:
|
||||
List all locally available casks (including tapped ones). No online search is performed.
|
||||
* `--desc`:
|
||||
|
@ -1,7 +1,7 @@
|
||||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "BREW\-CASK" "1" "February 2020" "Homebrew" "brew-cask"
|
||||
.TH "BREW\-CASK" "1" "March 2020" "Homebrew" "brew-cask"
|
||||
.
|
||||
.SH "NAME"
|
||||
\fBbrew\-cask\fR \- a friendly binary installer for macOS
|
||||
|
@ -1,7 +1,7 @@
|
||||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "BREW" "1" "February 2020" "Homebrew" "brew"
|
||||
.TH "BREW" "1" "March 2020" "Homebrew" "brew"
|
||||
.
|
||||
.SH "NAME"
|
||||
\fBbrew\fR \- The Missing Package Manager for macOS
|
||||
@ -548,6 +548,10 @@ Perform a substring search of cask tokens and formula names for \fItext\fR\. If
|
||||
If no \fItext\fR is provided, list all locally available formulae (including tapped ones)\. No online search is performed\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-formulae\fR
|
||||
List all locally available formulae\. No online search is performed\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-casks\fR
|
||||
List all locally available casks (including tapped ones)\. No online search is performed\.
|
||||
.
|
||||
|
Loading…
x
Reference in New Issue
Block a user