@@ -16,6 +16,7 @@ def run
1616 end
1717
1818 def execute
19+ warn_old_debug_flag if ENV [ "CSSCSS_DEBUG" ]
1920
2021 all_redundancies = @argv . map do |filename |
2122 contents = if %w( .scss .sass ) . include? ( File . extname ( filename ) . downcase ) && !( filename =~ URI . regexp )
@@ -69,10 +70,10 @@ def execute
6970 rescue Parslet ::ParseFailed => e
7071 line , column = e . cause . source . line_and_column
7172 puts "Had a problem parsing the css at line: #{ line } , column: #{ column } " . red
72- if ENV [ 'CSSCSS_DEBUG' ] == 'true'
73+ if @show_parser_errors || ENV [ 'CSSCSS_DEBUG' ] == 'true'
7374 puts e . cause . ascii_tree . red
7475 else
75- puts "Run with CSSCSS_DEBUG=true for verbose parser errors" . red
76+ puts "Run with --show-parser-errors for verbose parser errors" . red
7677 end
7778 exit 1
7879 end
@@ -122,6 +123,10 @@ def parse(argv)
122123 @json = j
123124 end
124125
126+ opts . on ( "--show-parser-errors" , "Print verbose parser errors" ) do |show_parser_errors |
127+ @show_parser_errors = show_parser_errors
128+ end
129+
125130 opts . on_tail ( "-h" , "--help" , "Show this message" ) do
126131 print_help ( opts )
127132 end
@@ -139,6 +144,10 @@ def print_help(opts)
139144 exit
140145 end
141146
147+ def warn_old_debug_flag
148+ $stderr. puts "CSSCSS_DEBUG is now deprecated. Use --show-parser-errors instead" . red
149+ end
150+
142151 class << self
143152 def run ( argv )
144153 new ( argv ) . run
0 commit comments