Skip to content

Instantly share code, notes, and snippets.

@mwilliammyers
Created December 21, 2015 21:16
Show Gist options
  • Save mwilliammyers/b979857471f9b9317605 to your computer and use it in GitHub Desktop.
Save mwilliammyers/b979857471f9b9317605 to your computer and use it in GitHub Desktop.
Search OS X and most of the Linux package managers for a provided package name.
#!/usr/bin/env ruby
def search_pkg(pkg)
# open_browser "https://www.macports.org/ports.php?by=name&substr=#{pkg}"
# open_browser "http://pdb.finkproject.org/pdb/browse.php?summary=#{pkg}"
# http://caskroom.io/search
# https://www.google.com/search?q=java&domains=www.openbsd.org&sitesearch=www.openbsd.org&btnG=Search&gfe_rd=ssl&ei=vqhiVr27EuGD8QedxJCwBg
open_browser "http://braumeister.org/search/#{pkg}"
open_browser "http://packages.ubuntu.com/search?keywords=#{pkg}&searchon=names&suite=all&section=all"
open_browser "https://packages.debian.org/search?keywords=#{pkg}&searchon=names&suite=all&section=all"
open_browser "https://www.archlinux.org/packages/?sort=&arch=x86_64&q=#{pkg}&maintainer=&flagged="
open_browser "https://software.opensuse.org/search?q=#{pkg}"
open_browser "https://packages.gentoo.org/packages/search?q=#{pkg}"
open_browser "https://admin.fedoraproject.org/pkgdb/packages/%2A#{pkg}%2A/"
end
def open_browser(*args)
# browser = ENV["HOMEBREW_BROWSER"] || ENV["BROWSER"] || OS::PATH_OPEN
browser = "open"
# This buys us proper argument quoting and evaluation
# of environment variables in the cmd parameter.
system "/bin/sh", "-c", "#{browser} \"$@\"", "--", *args
end
ARGV.each { |p| search_pkg(p) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment