cleanup: display total disk space to be cleared
Closes Homebrew/homebrew#45642. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
parent
e4f2a1e0ef
commit
090b133a01
@ -2,8 +2,15 @@ require "formula"
|
||||
require "keg"
|
||||
require "bottles"
|
||||
require "thread"
|
||||
require "utils"
|
||||
|
||||
module Homebrew
|
||||
@@disk_cleanup_size = 0
|
||||
|
||||
def update_disk_cleanup_size(path_size)
|
||||
@@disk_cleanup_size += path_size
|
||||
end
|
||||
|
||||
def cleanup
|
||||
if ARGV.named.empty?
|
||||
cleanup_cellar
|
||||
@ -16,6 +23,15 @@ module Homebrew
|
||||
else
|
||||
ARGV.resolved_formulae.each { |f| cleanup_formula(f) }
|
||||
end
|
||||
|
||||
if @@disk_cleanup_size > 0
|
||||
disk_space = disk_usage_readable(@@disk_cleanup_size)
|
||||
if ARGV.dry_run?
|
||||
ohai "This operation would free approximately #{disk_space} of disk space."
|
||||
else
|
||||
ohai "This operation has freed approximately #{disk_space} of disk space."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def cleanup_logs
|
||||
@ -113,6 +129,7 @@ module Homebrew
|
||||
puts "Removing: #{path}... (#{path.abv})"
|
||||
yield
|
||||
end
|
||||
update_disk_cleanup_size(path.disk_usage)
|
||||
end
|
||||
|
||||
def cleanup_lockfiles
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user