Module: Compass::Commands::CSSLintOptionsParser

Defined in:
lib/compass-csslint.rb

Instance Method Summary collapse

Instance Method Details

#set_options(opts) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/compass-csslint.rb', line 9

def set_options(opts)
  opts.banner = %Q{
    Usage: compass csslint [options]* [path/to/project]*

    Description:
      Compile project at the path specified or the current
      directory if not specified and then run CSS Lint
      against the generated CSS.

    Options:
  }.strip.split("\n").map{|l| l.gsub(/^ {0,10}/,'')}.join("\n")

  opts.on("-?", "-h", "--help", "Displays this information.") do
    puts opts
    exit
  end

  opts.on("--format=<format>", "Indicate which format to use for output.",
          "  One of: text, compact, lint-xml, csslint-xml, checkstyle-xml") do |format|
    self.options[:format] = format
  end

  opts.on("--list-rules", "Outputs all of the rules available.") do
    self.options[:list_rules] = true
    self.options[:nocompile] = true
  end

  opts.on("--quiet", "Only output when errors are present.") do
    self.options[:quiet] = true
  end

  opts.on("--errors=<rule[,rule]+>", "Indicate which rules to include as errors.") do |errors|
    self.options[:errors] = errors
  end

  opts.on("--warnings=<rule[,rule]+>", "Indicate which rules to include as warnings.") do |warnings|
    self.options[:warnings] = warnings
  end

  opts.on("--ignore=<rule,[,rule]+>", "Indicate which rules to ignore completely.") do |ignore|
    self.options[:ignore] = ignore
  end

  opts.on("--exclude-list=<file|dir[,file|dir]+>", "Indicate which files/directories to exclude from being linted.") do |exclude_list|
    self.options[:exclude_list] = exclude_list
  end

  opts.on("--version", "Outputs the current version number of CSS Lint.\n\n") do
    self.options[:version] = true
    self.options[:nocompile] = true
  end

  super
end