10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/file_charset_validator/cli.rb', line 10
def check(*paths)
if paths.empty?
self.help
return
end
encoding = get_encoding(options[:encoding] || 'UTF_8')
if encoding.nil?
STDERR.puts "Unknown encoding: #{options[:encoding]}"
exit 1
end
invalid_paths = FileCharsetValidator.invalid_encoding_paths(paths, encoding)
head = "Invalid encoding file: "
if !invalid_paths.empty?
STDERR.puts "#{head}#{invalid_paths.join("\n#{head}")}"
exit 1
end
end
|