Sha256: 72a81cc9dac290524214988c65d91081c9dc31bcf97103d9d972a23ec6325f5c

Contents?: true

Size: 489 Bytes

Versions: 1

Compression:

Stored size: 489 Bytes

Contents

# frozen_string_literal: true

module Doggy
  class CLI::Delete
    def run(ids)
      Doggy::Model.all_local_resources.each do |resource|
        next unless ids.include?(resource.id.to_s)
        Doggy.ui.say("Deleting #{resource.path}, with id #{resource.id}")
        resp = resource.destroy
        if resp['errors']
          Doggy.ui.error("Could not delete. Error: #{resp['errors']}. Skipping")
        else
          resource.destroy_local
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
doggy-3.0.0.pre.beta1 lib/doggy/cli/delete.rb