lib/scss_lint/cli.rb in scss-lint-0.23.1 vs lib/scss_lint/cli.rb in scss-lint-0.24.0
- old
+ new
@@ -63,10 +63,14 @@
opts.on('-f', '--format Formatter', 'Specify how to display lints', String) do |format|
define_output_format(format)
end
+ opts.on_tail('--show-formatters', 'Shows available formatters') do
+ print_formatters
+ end
+
opts.on('-i', '--include-linter linter,...', Array,
'Specify which linters you want to run') do |linters|
@options[:included_linters] = linters
end
@@ -192,9 +196,23 @@
def define_output_format(format)
@options[:reporter] = SCSSLint::Reporter.const_get(format + 'Reporter')
rescue NameError
puts "Invalid output format specified: #{format}"
halt :config
+ end
+
+ def print_formatters
+ puts 'Installed formatters:'
+
+ reporter_names = SCSSLint::Reporter.descendants.map do |reporter|
+ reporter.name.split('::').last.split('Reporter').first
+ end
+
+ reporter_names.sort.each do |reporter_name|
+ puts " - #{reporter_name}"
+ end
+
+ halt
end
def print_linters
puts 'Installed linters:'