Class: MdSpell::CLI
Overview
Class responsible for parsing all of command line arguments.
Instance Method Summary collapse
-
#files ⇒ Object
List of markdown files from argument list.
- #run(options) ⇒ Object
Instance Method Details
#files ⇒ Object
List of markdown files from argument list.
59 60 61 62 63 64 65 66 67 |
# 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) ⇒ Object
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() raise ArgumentError, 'expected Array of command line options' unless .is_a? Array # Start clean MdSpell::Configuration.reset () # Load optional config file if it's present. if config[:config_file] config_filename = File.(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 |