Skip to content

Commit

Permalink
Deprecates CSSCSS_DEBUG in favor of --show-parser-errors
Browse files Browse the repository at this point in the history
refs: #9
  • Loading branch information
zmoazeni committed Apr 12, 2013
1 parent e7a2be9 commit 6036abe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Added CONTRIBUTORS.md
* Fixes bugs with urls that have dashes in them
* Fixes bugs with urls containing encoded data (usually images)
* Deprecates CSSCSS_DEBUG in favor of --show-parser-errors

## 1.0.0 - 4/7/2013 ##

Expand Down
13 changes: 11 additions & 2 deletions lib/csscss/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def run
end

def execute
warn_old_debug_flag if ENV["CSSCSS_DEBUG"]

all_redundancies = @argv.map do |filename|
contents = if %w(.scss .sass).include?(File.extname(filename).downcase) && !(filename =~ URI.regexp)
Expand Down Expand Up @@ -69,10 +70,10 @@ def execute
rescue Parslet::ParseFailed => e
line, column = e.cause.source.line_and_column
puts "Had a problem parsing the css at line: #{line}, column: #{column}".red
if ENV['CSSCSS_DEBUG'] == 'true'
if @show_parser_errors || ENV['CSSCSS_DEBUG'] == 'true'
puts e.cause.ascii_tree.red
else
puts "Run with CSSCSS_DEBUG=true for verbose parser errors".red
puts "Run with --show-parser-errors for verbose parser errors".red
end
exit 1
end
Expand Down Expand Up @@ -122,6 +123,10 @@ def parse(argv)
@json = j
end

opts.on("--show-parser-errors", "Print verbose parser errors") do |show_parser_errors|
@show_parser_errors = show_parser_errors
end

opts.on_tail("-h", "--help", "Show this message") do
print_help(opts)
end
Expand All @@ -139,6 +144,10 @@ def print_help(opts)
exit
end

def warn_old_debug_flag
$stderr.puts "CSSCSS_DEBUG is now deprecated. Use --show-parser-errors instead".red
end

class << self
def run(argv)
new(argv).run
Expand Down

0 comments on commit 6036abe

Please sign in to comment.