Sha256: 17827a00c269046dbc0e8c2329cd37231438246537ef8126f1a69622b860113d
Contents?: true
Size: 800 Bytes
Versions: 1
Compression:
Stored size: 800 Bytes
Contents
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 puts retrieve_sig when 'pronto' then puts create_sig_from(input) else abort 'usage: signore prego|pronto [tag, …]' end end attr_reader :repo, :settings private :repo, :settings private def create_sig_from(input) SigFromStream.sig_from(input, tags: tags).tap { |sig| repo << sig } end def retrieve_sig repo.find(tags: tags) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
signore-0.3.2 | lib/signore/cli.rb |