cmd/search: add repology

I often find myself checking Repology to quickly reference how other
package managers handle certain things, so it seems useful to be able to
do so with `brew search`.

While we're here, let's fix the query URL for MacPorts.
This commit is contained in:
Carlo Cabrera 2021-07-18 09:22:34 +08:00
parent 12d272abe8
commit 822170a766
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0

View File

@ -15,7 +15,8 @@ module Homebrew
extend Search extend Search
PACKAGE_MANAGERS = { PACKAGE_MANAGERS = {
macports: ->(query) { "https://www.macports.org/ports.php?by=name&substr=#{query}" }, repology: ->(query) { "https://repology.org/projects/?search=#{query}" },
macports: ->(query) { "https://ports.macports.org/search/?q=#{query}" },
fink: ->(query) { "https://pdb.finkproject.org/pdb/browse.php?summary=#{query}" }, fink: ->(query) { "https://pdb.finkproject.org/pdb/browse.php?summary=#{query}" },
opensuse: ->(query) { "https://software.opensuse.org/search?q=#{query}" }, opensuse: ->(query) { "https://software.opensuse.org/search?q=#{query}" },
fedora: ->(query) { "https://apps.fedoraproject.org/packages/s/#{query}" }, fedora: ->(query) { "https://apps.fedoraproject.org/packages/s/#{query}" },
@ -53,7 +54,7 @@ module Homebrew
package_manager_switches = PACKAGE_MANAGERS.keys.map { |name| "--#{name}" } package_manager_switches = PACKAGE_MANAGERS.keys.map { |name| "--#{name}" }
package_manager_switches.each do |s| package_manager_switches.each do |s|
switch s, switch s,
description: "Search for <text> in the given package manager's list." description: "Search for <text> in the given database's or package manager's list."
end end
conflicts "--desc", "--pull-request" conflicts "--desc", "--pull-request"