class MdSpell::CLI

Class responsible for parsing all of command line arguments.

Public Instance Methods

files() click to toggle source

List of markdown files from argument list.

# File lib/mdspell/cli.rb, line 59
def files
  cli_arguments.each_with_index do |filename, index|
    if Dir.exist?(filename)
      cli_arguments[index] = Dir["#{filename}/**/*.md"]
    end
  end
  cli_arguments.flatten!
  cli_arguments
end
run(options) click to toggle source
# 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