module SwitchDb

Constants

VERSION

Public Class Methods

configuration() click to toggle source
# File lib/switch_db.rb, line 14
def self.configuration
  @configuration ||= Configuration.new
end
run(argv) click to toggle source
# File lib/switch_db.rb, line 18
def self.run(argv)
  option_parser = SwitchDb::OptionParser.new(argv)
  args = option_parser.parse!
  command = args.delete(:command)

  Cli.run!(command, args)
rescue SwitchDb::CommandNotFound => error
  $stderr.puts(error.message)
  $stderr.puts
  $stderr.puts(option_parser.option_parser.banner)
rescue SwitchDb::UnknownConfigurationKey => error
  $stderr.puts(error.message)
  $stderr.puts
  $stderr.puts("Allowed configuration keys are #{configuration.configuration_keys.map(&:to_s)}")
  $stderr.puts
  $stderr.puts(option_parser.option_parser.banner)
end