Method: AppleBot::Shell#result

Defined in:
lib/applebot/shell.rb

#result(output, format, print_result) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/applebot/shell.rb', line 41

def result(output, format, print_result)
  result = JSON.parse(output)['result']

  case format.to_s
  when 'pretty'
    table(result).tap do |t|
      puts t if print_result
    end
    true
  else
    result.tap do |json|
      puts json if print_result
    end
  end
end