<commit_before>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<commit_msg>CLI#run: don’t call Settings#tags twice<commit_after>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)
      tags = settings.tags
      case settings.action
      when 'prego'
        puts db.find(tags: tags)
      when 'pronto'
        sig = SigFromStream.sig_from(input, tags: tags)
        db << sig
        puts sig
      else
        abort 'usage: signore prego|pronto [tag, …]'
      end
    end

    attr_reader :db, :settings
    private     :db, :settings
  end
end
{'fraction_non_alphanumeric': 0.09111277072442121, 'fraction_numerical': 0.0, 'mean_word_length': 2.392405063291139, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2803275', 'n_tokens_mistral': 432, 'n_tokens_neox': 427, 'n_words': 119}