Sha256: 5bd0e67b54727341d0f7a2f44a29c81629a986e054cedb66e50e141f1ca25f6f

Contents?: true

Size: 628 Bytes

Versions: 1

Compression:

Stored size: 628 Bytes

Contents

require_relative 'database'
require_relative 'settings'
require_relative 'sig_from_stream'

module Signore
  class CLI
    def initialize(args = ARGV, db: Database.new)
      @settings = Settings.new(args)
      @db       = db
    end

    def run(input: $stdin)
      case settings.action
      when 'prego'
        puts db.find(tags: settings.tags)
      when 'pronto'
        sig = SigFromStream.sig_from(input, tags: settings.tags)
        db << sig
        puts sig
      else
        abort 'usage: signore prego|pronto [tag, …]'
      end
    end

    attr_reader :db, :settings
    private     :db, :settings
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
signore-0.2.3 lib/signore/cli.rb