Class: RedfishTools::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/redfish_tools/cli.rb,
lib/redfish_tools/cli/serve.rb

Defined Under Namespace

Classes: Serve

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/redfish_tools/cli.rb', line 14

def self.exit_on_failure?
  true
end

.start(args = ARGV) ⇒ Object



7
8
9
10
11
12
# 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

Instance Method Details

#serve(path) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/redfish_tools/cli.rb', line 34

def serve(path)
  user = options[:user]
  pass = options[:pass]
  raise Thor::Error, "Missing password" if user && pass.nil?
  raise Thor::Error, "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