class EcoRake module Lib module Notify class Mailer < EcoRake::Lib::BaseTask option '-t', '--to EMAIL', String, 'Destination recipient', required: true option '-s', '--subject SUBJECT', String, 'Subject of the email', required: true option '-m', '--body MESSAGE', String, 'The message of the email', required: true option '-c', '--cc EMAIL', String, 'CCing someone else' option '-b', '--bcc EMAIL', String, 'BCCing someone else' def task(*_args) kargs = { to: options[:to], subject: options[:subject], body: options[:body] } kargs.merge!(cc: options[:cc]) if options[:cc] kargs.merge!(bcc: options[:bcc]) if options[:bcc] mailer.mail(**kargs) end end end end end