Sha256: e1b9ed0e7c430ec6169f42a834684fe2274df0850fdbb48edd847e784d45db7c
Contents?: true
Size: 967 Bytes
Versions: 2
Compression:
Stored size: 967 Bytes
Contents
# frozen_string_literal: true require 'forwardable' require_relative 'repo' require_relative 'settings' require_relative 'sig_from_stream' module Signore class CLI extend Forwardable delegate %i(action tags) => :settings def initialize(args = ARGV, repo: Repo.new) @settings = Settings.new(args) @repo = repo end def run(input: $stdin) case action when 'prego' then prego when 'pronto' then puts create_sig_from(input) else abort 'usage: signore prego|pronto [tag, …]' end end private attr_reader :repo, :settings def prego sig = repo.find(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 } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
signore-0.6.0 | lib/signore/cli.rb |
signore-0.5.0 | lib/signore/cli.rb |