bin/yaml-validator in yaml-validator-0.0.1 vs bin/yaml-validator in yaml-validator-0.1.0

- old
+ new

@@ -1,15 +1,28 @@ #!/usr/bin/env ruby require_relative '../lib/yaml-validator' +require 'colorize' def main + show_missing = true + if ARGV.include? '--no-missing' + show_missing = false + ARGV.delete '--no-missing' + end + root_path = '.' root_path = ARGV[0] if ARGV.length > 0 - puts "Validating #{root_path}" - errors = YamlValidator.new(root_path).validate() + puts "Validating #{root_path}...\n\n".colorize(:blue).underline + validator = YamlValidator.new(root_path, :show_missing => show_missing) + errors = validator.validate() puts errors - puts "\nfound #{errors.length} errors" + + if errors.length > 0 + puts "\nfound #{errors.length} error(s)".colorize(:red).underline + else + puts "no errors".colorize(:green).underline + end end main()