lib/prmd/cli/verify.rb in prmd-0.10.0 vs lib/prmd/cli/verify.rb in prmd-0.11.0
- old
+ new
@@ -20,10 +20,13 @@
yield :yaml, y
end
opts.on('-o', '--output-file FILENAME', String, 'File to write result to') do |n|
yield :output_file, n
end
+ opts.on('-s', '--custom-schema FILENAME', String, 'Path to custom schema') do |n|
+ yield :custom_schema, n
+ end
end
end
# Executes the 'verify' command.
#
@@ -33,10 +36,11 @@
# @param (see Prmd::CLI::Base#execute)
# @return (see Prmd::CLI::Base#execute)
def self.execute(options = {})
filename = options.fetch(:argv).first
_, data = try_read(filename)
- errors = Prmd.verify(data)
+ custom_schema = options[:custom_schema]
+ errors = Prmd.verify(data, custom_schema: custom_schema)
unless errors.empty?
errors.map! { |error| "#{filename}: #{error}" } if filename
errors.each { |error| $stderr.puts(error) }
exit(1)
end