Module: Compass::Commands::CsscssOptionsParser

Defined in:
lib/compass-csscss.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/compass-csscss.rb', line 9

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

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

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

  opts.on("-v", "--[no-]verbose", "Display each rule") do |verbose|
    self.options[:verbose] = verbose
  end

  opts.on("--[no-]color", "Colorize output", "(default is true)") do |color|
    self.options[:color] = color
  end

  opts.on("-n", "--num N", "Print matches with at least this many rules.", "(default is 3)") do |num|
    self.options[:num] = num
  end

  opts.on("--[no-]match-shorthand", "Expand shorthand rules and matches on explicit rules", "(default is true)") do |match_shorthand|
    self.options[:match_shorthand] = match_shorthand
  end

  opts.on("-j", "--[no-]json", "Output results in JSON") do |json|
    self.options[:json] = json
  end

  opts.on("-S", "--src", "--sass", "--scss", "Parse your sass/scss source files instead of your generated CSS") do |sass|
    self.options[:sass] = sass
  end

  opts.on("--ignore-sass-mixins", "EXPERIMENTAL: Ignore matches that come from including sass/scss mixins",
          "This is an experimental feature and may not be included in future releases",
          "(default is false)") do |ignore_sass_mixins|
    self.options[:ignore_sass_mixins] = ignore_sass_mixins
  end

  opts.on("--require file.rb", "Load ruby file before running csscss.", "Great for bootstrapping requires/configurations") do |file|
    self.options[:file] = file
  end

  opts.on("--ignore-properties property1,property2,...", "Ignore these properties when finding matches") do |ignored_properties|
    self.options[:ignored_properties] = ignored_properties
  end

  opts.on('--ignore-selectors "selector1","selector2",...', "Ignore these selectors when finding matches") do |ignored_selectors|
    self.options[:ignored_selectors] = ignored_selectors
  end

  opts.on("--show-parser-errors", "Print verbose parser errors") do |show_parser_errors|
    self.options[:show_parser_errors] = show_parser_errors
  end

  opts.on("-V", "--version", "Show version of csscss") do
    self.options[:version] = true
    self.options[:nocompile] = true
  end

  opts.on("-?", "-h", "--help", "Show this message\n\n") do
    puts opts
    exit
  end

  super
end