Skip to content

Commit 6036abe

Browse files
committed
Deprecates CSSCSS_DEBUG in favor of --show-parser-errors
refs: zmoazeni#9
1 parent e7a2be9 commit 6036abe

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Added CONTRIBUTORS.md
66
* Fixes bugs with urls that have dashes in them
77
* Fixes bugs with urls containing encoded data (usually images)
8+
* Deprecates CSSCSS_DEBUG in favor of --show-parser-errors
89

910
## 1.0.0 - 4/7/2013 ##
1011

lib/csscss/cli.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)