brew/Library/Homebrew/cmd/cleanup.rb
Baptiste Fontaine 9bdd6619e2 cleanup: move code away from cmd/
Closes Homebrew/homebrew#47484.

Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2016-01-04 13:17:21 +01:00

22 lines
530 B
Ruby

require "cleanup"
require "utils"
module Homebrew
def cleanup
if ARGV.named.empty?
Cleanup.cleanup
else
ARGV.resolved_formulae.each { |f| Cleanup.cleanup_formula f }
end
if Cleanup.disk_cleanup_size > 0
disk_space = disk_usage_readable(Cleanup.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
end