Module: Choria::Colt::CLI::Formatter::Result

Defined in:
lib/choria/colt/cli/formatter.rb

Instance Method Summary collapse

Instance Method Details

#exitcodeObject



13
14
15
# File 'lib/choria/colt/cli/formatter.rb', line 13

def exitcode
  dig(:data, :exitcode)
end

#ok?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/choria/colt/cli/formatter.rb', line 17

def ok?
  exitcode&.zero?
end

#outputObject

CLI



30
31
32
33
34
35
36
# File 'lib/choria/colt/cli/formatter.rb', line 30

def output
  if dig(:result, :_output).nil?
    JSON.pretty_generate(self[:result]).split("\n")
  else
    dig(:result, :_output)
  end
end

#runtimeObject



21
22
23
# File 'lib/choria/colt/cli/formatter.rb', line 21

def runtime
  dig(:data, :runtime)
end

#senderObject



9
10
11
# File 'lib/choria/colt/cli/formatter.rb', line 9

def sender
  self[:sender]
end

#statuscodeObject



25
26
27
# File 'lib/choria/colt/cli/formatter.rb', line 25

def statuscode
  self[:statuscode]
end

#stderrObject



38
39
40
# File 'lib/choria/colt/cli/formatter.rb', line 38

def stderr
  dig(:result, :_stderr)
end