Sha256: ba066702706baf99477fbe7f93f1d82b81fd300e5a5b8cfc699298336c13e373

Contents?: true

Size: 740 Bytes

Versions: 1

Compression:

Stored size: 740 Bytes

Contents

#!/usr/bin/env ruby

require 'mail'
require 'optparse'
require 'twmail'

OptionParser.new do |opts|
  banner = <<-HERE
#{opts.program_name} is a simple Mail Delivery Agent (MDA) that parses received mail and creates a new TaskWarrior task from the subject of the mail.

USAGE

Configure fetchmail to use #{opts.program_name} as MDA:

    # ~/.fetchmailrc
    mda #{opts.program_name}
HERE
  opts.banner = banner#.wrap
  opts.version = TaskWarriorMail::VERSION
end.parse!

mail = Mail.new(ARGF.read)
task_uuid = %x[task-uuid \"#{mail.subject}\"]
body = mail.text? ? mail.body.decoded : mail.text_part.body.decoded

SEPARATOR = '-- '
body = body.split(SEPARATOR)[0] if (body.include?(SEPARATOR))

%x[task '#{task_uuid}' annotate \"#{body}\"]

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twmail-0.0.6 bin/twmail