class TrashMan::CLI

Public Instance Methods

prune() click to toggle source
# File lib/trashman/cli.rb, line 24
def prune
  if options.dry_run
    say "This is a dry-run. No files will be deleted."
  end

  manager = TrashMan::Manager.new(options.provider, options)
  count = manager.cleanup! do |file|
    say " -- deleting #{file.key}", :yellow
  end

  if options.dry_run
    say "This was a dry-run. No files were deleted."
  else
    say "#{count} file(s) deleted.", :green
  end
# This seems dirty.
# However, if the Fog::Storage provider throws any error,
# the user will be notified. Errors can be related to
# authentication, nonexistent bucket, etc.
rescue => e
  say e.message
end