Sha256: 4995e9bbd54874aff727f70894eea8b26204cc7b50b612522ec38dc7856b6d72

Contents?: true

Size: 507 Bytes

Versions: 2

Compression:

Stored size: 507 Bytes

Contents

# encoding: utf-8
# 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

2 entries across 2 versions & 1 rubygems

Version Path
doggy-2.1.1 lib/doggy/cli/delete.rb
doggy-2.1.0 lib/doggy/cli/delete.rb