Sha256: 1967d1b86b4c987574b6064f41b038de97b12c639d3122e73d574ac1e1c8854f

Contents?: true

Size: 794 Bytes

Versions: 7

Compression:

Stored size: 794 Bytes

Contents

require 'scss_lint'
require 'colorize'
require 'optparse'

module SCSSLint
  class CLI
    def initialize(args)
      opts = OptionParser.new do |opts|
        opts.banner = 'Usage: scss-lint [scss-files]'
      end.parse!(args)

      files = SCSSLint.extract_files_from(opts)

      runner = Runner.new
      begin
        runner.run files
        report_lints(runner.lints)
        exit 1 if runner.lints?
      rescue NoFilesError => ex
        puts ex.message
        exit -1
      end
    end

    def report_lints(lints)
      lints.sort_by { |l| [l.filename, l.line] }.each do |lint|
        if lint.filename
          print "#{lint.filename}:".yellow
        else
          print 'line'.yellow
        end

        puts "#{lint.line} - #{lint.description}"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
scss-lint-0.5.2 lib/scss_lint/cli.rb
scss-lint-0.5.1 lib/scss_lint/cli.rb
scss-lint-0.5 lib/scss_lint/cli.rb
scss-lint-0.4 lib/scss_lint/cli.rb
scss-lint-0.3 lib/scss_lint/cli.rb
scss-lint-0.2 lib/scss_lint/cli.rb
scss-lint-0.1 lib/scss_lint/cli.rb