Sha256: e246b004dad9659a40276848b2ee28e74eda074e476f6c7654b56ede5837f883
Contents?: true
Size: 1.14 KB
Versions: 3
Compression:
Stored size: 1.14 KB
Contents
# frozen_string_literal: true module Mihari module Commands module Alert class << self def included(thor) thor.class_eval do include Dry::Monads[:result, :try] desc "add [PATH]", "Add an alert" # # @param [String] path # def add(path) Mihari::Database.with_db_connection do builder = Services::AlertBuilder.new(path) run_proxy_l = ->(proxy) { run_proxy proxy } result = builder.result.bind(run_proxy_l) alert = result.value! data = Entities::Alert.represent(alert) puts JSON.pretty_generate(data.as_json) end end no_commands do # # @param [Mihari::Services::AlertProxy] proxy # def run_proxy(proxy) Dry::Monads::Try[StandardError] do runner = Services::AlertRunner.new(proxy) runner.run end.to_result end end end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mihari-5.6.2 | lib/mihari/commands/alert.rb |
mihari-5.6.1 | lib/mihari/commands/alert.rb |
mihari-5.6.0 | lib/mihari/commands/alert.rb |