<commit_before>module DCase
  class Cli
    def initialize(options = {})
      @config = options[:config]
      @crypto = DCase::Crypto.new(@config.password)
    end

    def run
      supervisor = \
        case @config.side
        when 'local'
          puts "*** Local side is up, port:#{@config.port}"
          DCase::Local.new('0.0.0.0', 53, @crypto, @config)
        when 'server'
          puts "*** Server side is up, port:#{@config.port}"
          DCase::Server.new('0.0.0.0', @config.port, @crypto)
        end

      puts "*** Hit Ctrl+c to stop"
      trap("INT")  { supervisor.terminate; exit }
      trap("TERM") { supervisor.terminate; exit }
      sleep
    end
  end
end<commit_msg>using supervise to start service<commit_after>module DCase
  class Cli
    def initialize(options = {})
      @config = options[:config]
      @crypto = DCase::Crypto.new(@config.password)
    end

    def run
      supervisor = \
        case @config.side
        when 'local'
          puts "*** Local side is up, port:#{@config.port}"
          DCase::Local.supervise('0.0.0.0', 53, @crypto, @config)
        when 'server'
          puts "*** Server side is up, port:#{@config.port}"
          DCase::Server.supervise('0.0.0.0', @config.port, @crypto)
        end

      puts "*** Hit Ctrl+c to stop"
      trap("INT")  { supervisor.terminate; exit }
      trap("TERM") { supervisor.terminate; exit }
      sleep
    end
  end
end
{'fraction_non_alphanumeric': 0.14773519163763066, 'fraction_numerical': 0.013937282229965157, 'mean_word_length': 2.2125279642058167, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, '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': '5727150', 'n_tokens_mistral': 473, 'n_tokens_neox': 467, 'n_words': 113}