aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/cleanup.rb
blob: 7d891787a7146262466f4f88b19dc14f605331e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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