Method: MdSpell::CLI#run

Defined in:
lib/mdspell/cli.rb

#run(options) ⇒ Object

Raises:

  • (ArgumentError)


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

def run(options)
  raise ArgumentError, 'expected Array of command line options' unless options.is_a? Array

  # Start clean
  MdSpell::Configuration.reset

  parse_options(options)
  # Load optional config file if it's present.
  if config[:config_file]
    config_filename = File.expand_path(config[:config_file])
    MdSpell::Configuration.from_file(config_filename) if File.exist?(config_filename)
  end

  # Store command line configuration options.
  MdSpell::Configuration.merge!(config)
end