#!/usr/bin/env node
'use strict';

var Ehlo = require('./ehlo.js')
  , program = require('commander')
  , pkg = require('./package.json')
;


process.argv[1] = 'ehlo';
program
  .version(pkg.version)
  .option(
    '-p, --port <n>'
    , 'The port to bind the smtp on. Default to 10025'
    , parseInt
  )
  .option('-a, --api [url]', 'The url to post emails')
  .parse(process.argv)
;

var ehlo = new Ehlo({port: program.port});
ehlo.use(require('./lib/middleware.parse'));

if (program.api) {
  ehlo
    .use(function(mail, smtp, next) {
      mail.api = program.api;
      next();
    })
    .use(require('./lib/middleware.api'))
  ;
}

ehlo
  .use(require('./lib/middleware.smtp.250'))
  .start()
;

process.on('SIGINT', function() {
  ehlo.stop();
  process.exit();
});

@@ -95,16 +95,53 @@
 ander')%0A
+  , logger = require('./lib/logger')%0A
   , pkg 
@@ -398,29 +398,189 @@
 %0A  .
-parse(process.argv)%0A;
+option('-d, --debug', 'Enable SMTP debug')%0A  .parse(process.argv)%0A;%0A%0Alogger.transports.console.level = 'verbose';%0Aif (program.debug) %7B%0A  logger.transports.console.level = 'debug';%0A%7D
 %0A%0Ava

Add debug option