lib/scss_lint/cli.rb in scss-lint-0.31.0 vs lib/scss_lint/cli.rb in scss-lint-0.32.0
- old
+ new
@@ -29,10 +29,11 @@
private
def act_on_options(options)
load_required_paths(options)
+ load_reporters(options)
if options[:help]
print_help(options)
elsif options[:version]
print_version
@@ -171,9 +172,21 @@
end
def load_required_paths(options)
Array(options[:required_paths]).each do |path|
require path
+ end
+ end
+
+ def load_reporters(options)
+ options[:reporters].map! do |reporter_name, output_file|
+ begin
+ reporter = SCSSLint::Reporter.const_get(reporter_name + 'Reporter')
+ rescue NameError
+ raise SCSSLint::Exceptions::InvalidCLIOption,
+ "Invalid output format specified: #{reporter_name}"
+ end
+ [reporter, output_file]
end
end
def print_formatters
puts 'Installed formatters:'