Sha256: a091c9dfa52884f79822643d39efc279d64f0d477d78306dc5d0c1c24b9eff99

Contents?: true

Size: 737 Bytes

Versions: 5

Compression:

Stored size: 737 Bytes

Contents

# frozen_string_literal: true

module Mihari
  module Commands
    module Validator
      def self.included(thor)
        thor.class_eval do
          desc "rule [PATH]", "Validate rule file format"
          #
          # Validate format of a rule
          #
          # @param [String] path
          #
          # @return [nil]
          #
          def rule(path)
            rule = Structs::Rule.from_path_or_id(path)

            begin
              rule.validate!
              Mihari.logger.info "Valid format. The input is parsed as the following:"
              Mihari.logger.info rule.data.to_yaml
            rescue RuleValidationError
              nil
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mihari-4.12.0 lib/mihari/commands/validator.rb
mihari-4.11.0 lib/mihari/commands/validator.rb
mihari-4.10.0 lib/mihari/commands/validator.rb
mihari-4.9.0 lib/mihari/commands/validator.rb
mihari-4.8.0 lib/mihari/commands/validator.rb