<commit_before>#!/usr/bin/env ruby

$stdout.sync = true

require 'optparse'

require File.expand_path(File.dirname(__FILE__) + '/../lib/ryespy')


# = Parse opts

options = {}

OptionParser.new do |opts|
  opts.banner = "Usage: ryespy [options]"
  
  opts.separator ""
  opts.separator "Polling:"
  
  opts.on("-e", "--[no-]eternal", "Run eternally") do |o|
    options[:eternal] = o
  end
  
  opts.on("--polling-interval [N]", "Poll every N seconds when --eternal") do |o|
    options[:polling_interval] = o.to_i
  end
  
  opts.separator ""
  opts.separator "Other:"
  
  opts.on("-v", "--[no-]verbose", "Be somewhat verbose") do |o|
    options[:verbose] = o
  end
  
  opts.on_tail("--help", "Show this message") do
    puts opts
    exit
  end
  
  opts.on_tail("--version", "Show version") do
    puts "Ryespy version:#{Ryespy::VERSION}"
    exit
  end
end.parse!


# = Configure

Ryespy.configure do |c|
  c.log_level = 'DEBUG' if options[:verbose]
  
  c.polling_interval = options[:polling_interval] if options[:polling_interval]
end

@logger = Ryespy.logger


# = Main loop

loop do
  # TODO: Poll listener.
  
  break unless options[:eternal]
  
  @logger.debug { "Snoring for #{Ryespy.config.polling_interval} s" }
  
  sleep Ryespy.config.polling_interval # Sleep awhile.
end<commit_msg>Restrict executable --polling-interval to Integer.<commit_after>#!/usr/bin/env ruby

$stdout.sync = true

require 'optparse'

require File.expand_path(File.dirname(__FILE__) + '/../lib/ryespy')


# = Parse opts

options = {}

OptionParser.new do |opts|
  opts.banner = "Usage: ryespy [options]"
  
  opts.separator ""
  opts.separator "Listener:"
  
  opts.on("-l", "--listener LISTENER", [:imap, :ftp], "Listener (imap|ftp)") do |o|
    options[:listener] = o
  end
  
  opts.separator ""
  opts.separator "Polling:"
  
  opts.on("-e", "--[no-]eternal", "Run eternally") do |o|
    options[:eternal] = o
  end
  
  opts.on("--polling-interval [N]", Integer, "Poll every N seconds when --eternal") do |o|
    options[:polling_interval] = o
  end
  
  opts.separator ""
  opts.separator "Other:"
  
  opts.on("-v", "--[no-]verbose", "Be somewhat verbose") do |o|
    options[:verbose] = o
  end
  
  opts.on_tail("--help", "Show this message") do
    puts opts
    exit
  end
  
  opts.on_tail("--version", "Show version") do
    puts "Ryespy version:#{Ryespy::VERSION}"
    exit
  end
end.parse!


# = Configure

Ryespy.configure do |c|
  c.log_level = 'DEBUG' if options[:verbose]
  
  c.polling_interval = options[:polling_interval] if options[:polling_interval]
end

@logger = Ryespy.logger


# = Main loop

loop do
  # TODO: Poll listener.
  
  break unless options[:eternal]
  
  @logger.debug { "Snoring for #{Ryespy.config.polling_interval} s" }
  
  sleep Ryespy.config.polling_interval # sleep awhile (snore)
end
{'fraction_non_alphanumeric': 0.15627214741318213, 'fraction_numerical': 0.0, 'mean_word_length': 3.31651376146789, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7005416', 'n_tokens_mistral': 1061, 'n_tokens_neox': 1029, 'n_words': 242}