lib/signore/cli.rb in signore-0.6.0 vs lib/signore/cli.rb in signore-0.7.0
- old
+ new
@@ -1,17 +1,16 @@
-# frozen_string_literal: true
-
require 'forwardable'
require_relative 'repo'
require_relative 'settings'
+require_relative 'sig_finder'
require_relative 'sig_from_stream'
module Signore
class CLI
extend Forwardable
- delegate %i(action tags) => :settings
+ delegate %i[action tags] => :settings
def initialize(args = ARGV, repo: Repo.new)
@settings = Settings.new(args)
@repo = repo
end
@@ -27,18 +26,18 @@
private
attr_reader :repo, :settings
def prego
- sig = repo.find(tags: tags)
+ sig = SigFinder.find(repo.sigs, tags: tags)
puts case
when repo.empty? then 'No signatures found.'
when sig.empty? then "Sadly no signatures are tagged #{tags}."
else sig
end
end
def create_sig_from(input)
- SigFromStream.sig_from(input, tags: tags).tap { |sig| repo << sig }
+ SigFromStream.call(input, tags: tags).tap { |sig| repo << sig }
end
end
end