aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRakesh2015-11-17 16:51:56 +0530
committerMike McQuaid2015-12-30 08:12:03 +0000
commit090b133a01d3918ea6a0d73768b836185a8dce35 (patch)
tree1534238fc641fd16228601c69d2ae63fa2d3d0bc
parente4f2a1e0ef83d426bb167f003c06369fdce54db2 (diff)
downloadbrew-090b133a01d3918ea6a0d73768b836185a8dce35.tar.bz2
cleanup: display total disk space to be cleared
Closes Homebrew/homebrew#45642. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
-rw-r--r--Library/Homebrew/cmd/cleanup.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/cleanup.rb b/Library/Homebrew/cmd/cleanup.rb
index 3439fd99a..e01a809b5 100644
--- a/Library/Homebrew/cmd/cleanup.rb
+++ b/Library/Homebrew/cmd/cleanup.rb
@@ -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