#!/usr/bin/env ruby require 'commander/import' require 'html_email_creator' require 'html_email_creator/version' require 'html_email_creator/information' # :name is optional, otherwise uses the basename of this executable program :name, 'HTML Email Creator' program :version, HtmlEmailCreator::VERSION program :description, HtmlEmailCreator::DESCRIPTION command :create do |c| c.syntax = 'html_email_creator create ' c.description = 'Creates a single email or all emails from the directory' c.option '--norecursive', 'If creating directory, don\'t look into sub directories.' c.action do |args, options| # TODO implement me recursive = options.norecursive ? false : true full_path = File.expand_path(args.first, Dir.pwd) results = HtmlEmailCreator::EmailCreator.new.save_emails(full_path, recursive) say "Creation completed!\n\n" results.each_pair do |file, format| say "#{file}:" say " Output:" format.values.each do |output| say " #{output}" end end say "\nHave a nice day :)" end end