diff options
| author | Andre Arko | 2009-09-04 15:22:25 -0700 |
|---|---|---|
| committer | Max Howell | 2009-09-05 15:09:17 +0100 |
| commit | c4041f4492bbcba8cb355bbd31996d4cc3bd8e62 (patch) | |
| tree | 776c5e789d6f559f73672249e3bec36f62575f61 /Library/Homebrew | |
| parent | a2cd3367a8221c757f50f8cece0dcaaff10846a3 (diff) | |
| download | brew-c4041f4492bbcba8cb355bbd31996d4cc3bd8e62.tar.bz2 | |
`brew search' command
Example usage:
brew search w # formulae containing w
brew search ^w # formulae starting with w
No parameters lists all packages.
Also adds puts_columns to util, and uses it for output.
Signed Off By: Max Howell <max@methylblue.com>
I changed the command from 'available' to search because this is more similar
to how other tools call this function.
The short form is -S, which is the "pacman" tool equivalent.
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/ARGV+yeast.rb | 9 | ||||
| -rw-r--r-- | Library/Homebrew/utils.rb | 6 |
2 files changed, 11 insertions, 4 deletions
diff --git a/Library/Homebrew/ARGV+yeast.rb b/Library/Homebrew/ARGV+yeast.rb index 9c5317153..550350554 100644 --- a/Library/Homebrew/ARGV+yeast.rb +++ b/Library/Homebrew/ARGV+yeast.rb @@ -45,7 +45,7 @@ module HomebrewArgvExtension Keg.new d.children[0] end end - + # self documenting perhaps? def include? arg @n=index arg @@ -75,7 +75,7 @@ module HomebrewArgvExtension end return false end - + def usage <<-EOS Usage: brew command [formula] ... @@ -88,15 +88,16 @@ Commands: list formula ... link formula ... home formula ... + available [formula or regex] info [formula] [--github] make url prune - + To visit the Homebrew homepage type: brew home EOS end - + private def _named @named ||= reject{|arg| arg[0..0] == '-'}.collect{|arg| arg.downcase}.uniq diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 3c6a8e12c..8bd2537e5 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -74,3 +74,9 @@ end def curl url, *args safe_system 'curl', '-f#LA', HOMEBREW_USER_AGENT, url, *args end + +def puts_columns items, cols = 4 + items = items.join("\n") if items.is_a?(Array) + width=`stty size`.chomp.split(" ").last + IO.popen("pr -#{cols} -t", "w"){|io| io.write(items) } +end |
