Sha256: acfb10f2c62b587636bb1244b44a83d8afea711d5829eb6584fac114ec196fef

Contents?: true

Size: 503 Bytes

Versions: 14

Compression:

Stored size: 503 Bytes

Contents

class Ppl::Command::Rm < Ppl::Application::Command

  def initialize
    @name        = "rm"
    @description = "Delete a contact"
  end

  def options(parser, options)
    parser.banner = "usage: ppl rm <contact>"
  end

  def execute(input, output)
    contact_id = input.arguments.first

    if contact_id.nil?
      raise Ppl::Error::IncorrectUsage, "No contact specified"
    end

    contact = @storage.require_contact(contact_id)
    @storage.delete_contact(contact)
    return true
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ppl-1.5.2 lib/ppl/command/rm.rb
ppl-1.5.1 lib/ppl/command/rm.rb
ppl-1.5.0 lib/ppl/command/rm.rb
ppl-1.4.1 lib/ppl/command/rm.rb
ppl-1.3.0 lib/ppl/command/rm.rb
ppl-1.2.0 lib/ppl/command/rm.rb
ppl-1.1.0 lib/ppl/command/rm.rb
ppl-1.0.6 lib/ppl/command/rm.rb
ppl-1.0.5 lib/ppl/command/rm.rb
ppl-1.0.4 lib/ppl/command/rm.rb
ppl-1.0.3 lib/ppl/command/rm.rb
ppl-1.0.1 lib/ppl/command/rm.rb
ppl-1.0.0 lib/ppl/command/rm.rb
ppl-0.9.0 lib/ppl/command/rm.rb