Sha256: cbefab1ee7d023d81b555e0476c02fe0c2d4235380501936364029779abd90d1

Contents?: true

Size: 717 Bytes

Versions: 1

Compression:

Stored size: 717 Bytes

Contents

#!/usr/bin/env ruby
require "surrender"

options = ARGV.each_with_object(Surrender::DEFAULT_ARGUMENTS.dup) do |arg, memo|
  case arg
  when /^--most-recent=(\d+)$/
    memo[:most_recent] = Integer($1)
  when /^--weekly=(\d+)$/
    memo[:weekly] = Integer($1)
  when /^--monthly=(\d+)$/
    memo[:monthly] = Integer($1)
  when /^--yearly=(\d+)$/
    memo[:yearly] = Integer($1)
  else
    raise ArgumentError, "Unknown option #{arg.inspect}"
  end
end

ARGV.select{|arg| arg[0, 2] == "--"}.each{|arg| ARGV.delete(arg)}

unprocessable, deleteable = Surrender.reject(ARGF, options)
STDERR.puts unprocessable.map{|filename| "WARN: Filename #{filename.inspect} did not match the filter expression"}
STDOUT.puts deleteable

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
surrender-0.8.2 bin/surrender