Class: S3Sync::CLI::Delete

Inherits:
BaseCmd
  • Object
show all
Defined in:
lib/s3sync/cli.rb

Instance Method Summary collapse

Methods inherited from BaseCmd

#execute, #has_options?, #has_prefix?, #usage

Constructor Details

#initializeDelete

Returns a new instance of Delete.



225
226
227
228
229
230
231
# File 'lib/s3sync/cli.rb', line 225

def initialize
  super 'delete', takes_commands: false #, false

  @short_desc = "Delete a key from a bucket"

  @has_prefix = 'required'
end

Instance Method Details

#run(s3, bucket, key, file, args) ⇒ Object

Raises:



233
234
235
236
237
# File 'lib/s3sync/cli.rb', line 233

def run s3, bucket, key, file, args
  raise WrongUsage.new(nil, "You need to inform a bucket") if not bucket
  raise WrongUsage.new(nil, "You need to inform a key") if not key
  s3.buckets(bucket).object(key).delete
end