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]
|
Usage: #{name} [--prefix] [--cache] [--version]
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
install [formula] ...
|
install formula ...
|
||||||
rm [formula] ...
|
rm formula ...
|
||||||
list [formula] ...
|
list formula ...
|
||||||
ln [formula] ...
|
ln formula ...
|
||||||
info [formula]
|
info formula
|
||||||
|
abv [formula]
|
||||||
prune
|
prune
|
||||||
abv
|
|
||||||
EOS
|
EOS
|
||||||
end
|
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
|
######################################################################### impl
|
||||||
begin
|
begin
|
||||||
case ARGV.shift
|
case ARGV.shift
|
||||||
when 'abv'
|
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'
|
when 'prune'
|
||||||
puts "Pruned #{prune} files"
|
puts "Pruned #{prune} files"
|
||||||
when '--prefix'
|
when '--prefix'
|
||||||
# we use the cwd because __FILE__ can be relative and expand_path
|
# we use the cwd because __FILE__ can be relative and expand_path
|
||||||
# resolves the symlink for the working directory if fed a relative 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
|
cwd=Pathname.new `pwd`.strip
|
||||||
puts File.expand_path(cwd+__FILE__+'../../')
|
puts File.expand_path(cwd+__FILE__+'../../')
|
||||||
when '--cache'
|
when '--cache'
|
||||||
@ -214,10 +223,7 @@ begin
|
|||||||
ohai 'Finishing up'
|
ohai 'Finishing up'
|
||||||
o.clean
|
o.clean
|
||||||
ln name
|
ln name
|
||||||
puts "#{o.prefix}: "+`find #{o.prefix} -type f | wc -l`.strip+
|
puts "#{o.prefix}: "+abv(name)+", built in #{Time.now - beginning} seconds"
|
||||||
' files, '+
|
|
||||||
`du -hd0 #{o.prefix} | cut -d"\t" -f1`.strip+
|
|
||||||
", built in #{Time.now - beginning} seconds"
|
|
||||||
end
|
end
|
||||||
when 'ln'
|
when 'ln'
|
||||||
n=0
|
n=0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user