def destroy
      if current_command == "addons:remove"
        deprecate("`heroku #{current_command}` has been deprecated. Please use `heroku addons:destroy` instead.")
      end

      raise CommandFailed.new("Missing add-on name") if args.empty?

      requires_preauth
      confirmed_apps = []

      while addon_name = args.shift
        addon = resolve_addon!(addon_name)
        app   = addon['app']

        unless confirmed_apps.include?(app['name'])
          return unless confirm_command(app['name'])
          confirmed_apps << app['name']
        end

        addon_attachments = get_attachments(:resource => addon['id'])

        action("Destroying #{addon['name']} on #{app['name']}") do
          addon = api.request(
            :body     => json_encode({
              "force" => options[:force] || ENV['HEROKU_FORCE'] == '1',
            }),
            :expects  => 200..300,
            :headers  => {
              "Accept" => "application/vnd.heroku+json; version=3",
              "Accept-Expansion" => "plan"
            },
            :method   => :delete,
            :path     => "/apps/#{app['id']}/addons/#{addon['id']}"
          ).body
          @status = "(#{format_price addon['plan']['price']})" if addon['plan'].has_key?('price')
        end

        if addon['config_vars'].any? # litmus test for whether the add-on's attachments have vars
          # For each app that had an attachment, output a message indicating that
          # the app has been restarted any any associated vars have been removed.
          addon_attachments.group_by { |att| att['app']['name'] }.each do |app, attachments|
            names = attachments.map { |att| att['name'] }.join(', ')
            action("Removing vars for #{names} from #{app} and restarting") {
              @status = api.get_release(app, 'current').body['name']
            }
          end
        end
      end
    end
def destroy
      if current_command == "addons:remove"
        deprecate("`heroku #{current_command}` has been deprecated. Please use `heroku addons:destroy` instead.")
      end

      raise CommandFailed.new("Missing add-on name") if args.empty?

      requires_preauth
      confirmed_apps = []

      while addon_name = args.shift
        addon = resolve_addon!(addon_name)
        app   = addon['app']

        unless confirmed_apps.include?(app['name'])
          return unless confirm_command(app['name'])
          confirmed_apps << app['name']
        end

        addon_attachments = get_attachments(:resource => addon['id'])

        action("Destroying #{addon['name']} on #{app['name']}") do
          addon = api.request(
            :body     => json_encode({
              "force" => options[:force] || ENV['HEROKU_FORCE'] == '1',
            }),
            :expects  => 200..300,
            :headers  => {
              "Accept" => "application/vnd.heroku+json; version=3",
              "Accept-Expansion" => "plan"
            },
            :method   => :delete,
            :path     => "/apps/#{app['id']}/addons/#{addon['id']}"
          ).body
          @status = "(#{format_price addon['plan']['price']})" if addon['plan'].has_key?('price')
        end

        if addon['config_vars'].any? # litmus test for whether the add-on's attachments have vars
          # For each app that had an attachment, output a message indicating that
          # the app has been restarted any any associated vars have been removed.
          addon_attachments.group_by { |att| att['app']['name'] }.each do |app, attachments|
            names = attachments.map { |att| att['name'] }.join(', ')
            action("Removing vars for #{names} from #{app} and restarting") {
              @status = api.get_release(app, 'current').body['name']
            }
          end
        end
      end
    end
addons:destroy ADDON_NAME [ADDON_NAME ...]

 destroy add-on resources

 -f, --force # allow destruction even if add-on is attached to other apps