Class: Ppl::Application::Shell

Inherits:
Object
  • Object
show all
Defined in:
lib/ppl/application/shell.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#router=(value) ⇒ Object (writeonly)

Sets the attribute router

Parameters:

  • value

    the value to set the attribute router to.



5
6
7
# File 'lib/ppl/application/shell.rb', line 5

def router=(value)
  @router = value
end

Instance Method Details

#run(input, output) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ppl/application/shell.rb', line 7

def run(input, output)
  outcome = false
  begin
    command = select_command(input)
    prepare_command(command, input)
    outcome = execute_command(command, input, output)
  rescue Ppl::Error::CompletionNotFound
    output.error("ppl: No completion function available for '#{$!}'")
  rescue Ppl::Error::ContactNotFound
    output.error("ppl: Contact '#{$!}' not found")
  rescue Ppl::Error::PostalAddressNotFound
    output.error("ppl: Postal address '#{$!}' not found")
  rescue OptionParser::InvalidOption, OptionParser::MissingArgument, Ppl::Error::IncorrectUsage
    output.error($!)
    output.error(@optparse.to_s)
  rescue
    output.error("ppl: " + $!.message)
    outcome = false
  end
  return outcome
end