import { Command } from "commander"; import { SendEmail } from "lib/email/client"; import { MainHTMLWrapper } from "lib/email/formats"; import CreateLogCtx from "lib/logger/logger"; const program = new Command(); program.option("-e, --email "); const logger = CreateLogCtx(__filename); program.parse(process.argv); const options = program.opts(); if (!options.email) { throw new Error(`Need an --email to send to.`); } if (require.main === module) { (async () => { logger.info(`Sending email to ${options.email}.`); await SendEmail( options.email, "Hello World", MainHTMLWrapper("Hello world! This is a test email for doing things.") ); logger.info(`Done.`); process.exit(0); })(); }