mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Allow abv [formula]
This commit is contained in:
parent
459c883d40
commit
038abeeb10
30
bin/brew
30
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,10 +223,7 @@ 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"
|
||||
puts "#{o.prefix}: "+abv(name)+", built in #{Time.now - beginning} seconds"
|
||||
end
|
||||
when 'ln'
|
||||
n=0
|
||||
|
Loading…
x
Reference in New Issue
Block a user