aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Howell2009-06-05 08:09:34 +0100
committerMax Howell2009-06-05 09:50:02 +0100
commit038abeeb10f3ec700fb23cc3f0de68263d9cd3e6 (patch)
tree9cf52b886f1b6e609ee4fa19aaf7407fb8b952c2
parent459c883d40fcb1fd2cac4a8602813f9eb0d92a79 (diff)
downloadbrew-038abeeb10f3ec700fb23cc3f0de68263d9cd3e6.tar.bz2
Allow abv [formula]
-rwxr-xr-xbin/brew32
1 files changed, 19 insertions, 13 deletions
diff --git a/bin/brew b/bin/brew
index 4bb4403c1..f3213b33d 100755
--- a/bin/brew
+++ b/bin/brew
@@ -172,27 +172,36 @@ Usage: #{name} command [formula] ...
Usage: #{name} [--prefix] [--cache] [--version]
Commands:
- install [formula] ...
- rm [formula] ...
- list [formula] ...
- ln [formula] ...
- info [formula]
+ install formula ...
+ rm formula ...
+ list formula ...
+ ln formula ...
+ info formula
+ abv [formula]
prune
- abv
EOS
end
+def abv keg
+ keg=$cellar+keg
+ `find #{keg} -type f | wc -l`.strip+' files, '+`du -hd0 #{keg} | cut -d"\t" -f1`.strip
+end
+
######################################################################### impl
begin
case ARGV.shift
when 'abv'
- puts `find #{$cellar} -type f | wc -l`.strip+' files, '+`du -hd0 #{$cellar} | cut -d"\t" -f1`.strip
+ if ARGV.empty?
+ puts abv
+ else
+ puts abv(shift_formulae_from_ARGV[0])
+ end
when 'prune'
puts "Pruned #{prune} files"
when '--prefix'
# we use the cwd because __FILE__ can be relative and expand_path
# resolves the symlink for the working directory if fed a relative path
- # NOTE we don't use Dir.pwd because it resolves the symlink :P #rubysucks
+ # NOTE we don't use Dir.pwd because it resolves the symlink :(
cwd=Pathname.new `pwd`.strip
puts File.expand_path(cwd+__FILE__+'../../')
when '--cache'
@@ -214,11 +223,8 @@ begin
ohai 'Finishing up'
o.clean
ln name
- puts "#{o.prefix}: "+`find #{o.prefix} -type f | wc -l`.strip+
- ' files, '+
- `du -hd0 #{o.prefix} | cut -d"\t" -f1`.strip+
- ", built in #{Time.now - beginning} seconds"
- end
+ puts "#{o.prefix}: "+abv(name)+", built in #{Time.now - beginning} seconds"
+ end
when 'ln'
n=0
shift_formulae_from_ARGV.each {|name| n+=ln name}