class RedfishTools::Cli

Public Class Methods

exit_on_failure?() click to toggle source
# File lib/redfish_tools/cli.rb, line 14
def self.exit_on_failure?
  true
end
start(args = ARGV) click to toggle source
Calls superclass method
# File lib/redfish_tools/cli.rb, line 7
def self.start(args = ARGV)
  if HELP_MAPPINGS.any? { |flag| args.include?(flag) }
    args = ["--help", args.first]
  end
  super(args)
end

Public Instance Methods

listen_sse(address) click to toggle source
# File lib/redfish_tools/cli.rb, line 89
def listen_sse(address)
  require "redfish_tools/cli/listen_sse"
  ListenSse.new(address, options).run
end
record(service, path) click to toggle source
# File lib/redfish_tools/cli.rb, line 59
def record(service, path)
  username = ENV["REDFISH_USERNAME"]
  password = ENV["REDFISH_PASSWORD"]
  raise "Missing username" if username.nil?
  raise "Missing password" if password.nil?

  require "redfish_tools/cli/record"
  Record.new(service, path, username, password).run
rescue StandardError => e
  raise Thor::Error, e.to_s
end
serve(path) click to toggle source
# File lib/redfish_tools/cli.rb, line 34
def serve(path)
  user = options[:user]
  pass = options[:pass]
  raise "Missing password" if user && pass.nil?
  raise "Missing username" if user.nil? && pass

  require "redfish_tools/cli/serve"
  Serve.new(path, options).run
rescue StandardError => e
  raise Thor::Error, e.to_s
end
serve_sse(source) click to toggle source
# File lib/redfish_tools/cli.rb, line 83
def serve_sse(source)
  require "redfish_tools/cli/serve_sse"
  ServeSse.new(source, options).run
end