Sha256: 7c8b0096291cda5acf865072fc6d80feb563e7d1f6d052d7f7a94b4057b2efdf

Contents?: true

Size: 957 Bytes

Versions: 5

Compression:

Stored size: 957 Bytes

Contents

# coding: utf-8
require 'imap-filter'

include ImapFilter::DSL

module ImapFilter
  module Cli
    class Main < Thor
      class_option :verbose, type: :numeric, banner: '[1|2|3|4]', aliases: '-v', default: 0
      @@default_script = ENV['IMAPF_IMAP_FILE'] || 'default.imap'
      
      desc 'filter [script]', "Run the powerplay script. Default #{@@default_script}"
      option :dryrun, type: :boolean, aliases: '-u', desc: "Dry run, do not actually execute."
      option :test, type: :boolean, aliases: '-t', desc: "Test IMAP accounts only."
      option :filters, type: :array,   aliases: '-f', banner: %(<FILT1>[ FILT2 FILT3...]), 
                                                      desc: "Run specified filters. The default is to run all of them."
      def filter(script = @@default_script)
        _global[:options] = options
        puts "script %s " % [script] if _options[:verbose] >= 1
        load script, true
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
imap-filter-0.1.6 lib/imap-filter/cli.rb
imap-filter-0.1.5 lib/imap-filter/cli.rb
imap-filter-0.1.4 lib/imap-filter/cli.rb
imap-filter-0.0.3 lib/imap-filter/cli.rb
imap-filter-0.0.2 lib/imap-filter/cli.rb