Class: Ppl::Command::Rm

Inherits:
Application::Command show all
Defined in:
lib/ppl/command/rm.rb

Instance Attribute Summary

Attributes inherited from Application::Command

#storage

Instance Method Summary collapse

Methods inherited from Application::Command

add_property

Instance Method Details

#execute(input, output) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/ppl/command/rm.rb', line 10

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

#options(parser, options) ⇒ Object



6
7
8
# File 'lib/ppl/command/rm.rb', line 6

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