Sha256: ecdaa6e23b08a8bce1d84c314f07ae01b1407398526563f1704a1c3654e1b88c
Contents?: true
Size: 796 Bytes
Versions: 2
Compression:
Stored size: 796 Bytes
Contents
require 'forwardable' require_relative 'database' require_relative 'settings' require_relative 'sig_from_stream' module Signore class CLI extend Forwardable delegate %i(action tags) => :settings def initialize(args = ARGV, db: Database.new) @settings = Settings.new(args) @db = db 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 :db, :settings private :db, :settings private def create_sig_from(input) SigFromStream.sig_from(input, tags: tags).tap { |sig| db << sig } end def retrieve_sig db.find(tags: tags) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
signore-0.3.1 | lib/signore/cli.rb |
signore-0.3.0 | lib/signore/cli.rb |