Class: Glossarist::CLI::ValidateCommand
- Inherits:
-
Object
- Object
- Glossarist::CLI::ValidateCommand
- Defined in:
- lib/glossarist/cli/validate_command.rb
Instance Method Summary collapse
-
#initialize(path, options) ⇒ ValidateCommand
constructor
A new instance of ValidateCommand.
- #run ⇒ Object
Constructor Details
#initialize(path, options) ⇒ ValidateCommand
Returns a new instance of ValidateCommand.
9 10 11 12 |
# File 'lib/glossarist/cli/validate_command.rb', line 9 def initialize(path, ) @path = path @options = end |
Instance Method Details
#run ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/glossarist/cli/validate_command.rb', line 14 def run text_output = @options[:format] == "text" validator = DatasetValidator.new(on_progress: text_output ? method(:print_progress) : nil) result = validator.validate( @path, strict: @options[:strict], reference_path: @options[:reference_path], ) $stderr.print "\r#{' ' * 60}\r" if text_output report(result) exit(1) unless result.errors.empty? && !strict_failure?(result) end |