From 88d34d3a757fc36f80b019d1688ab1a2c57bf3dd Mon Sep 17 00:00:00 2001 From: Jeroen Engels Date: Fri, 1 Oct 2021 17:59:14 +0200 Subject: [PATCH] Pass options from program --- src/index.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index 7b3b912..1afe088 100644 --- a/src/index.ts +++ b/src/index.ts @@ -32,12 +32,11 @@ Give me an Elm file, I'll compile it behind the scenes using Elm 0.19.1, and the // .option('--replacements ', 'Replace stuff') .parse(process.argv); -async function run(inputFilePath: string | undefined) { +async function run(inputFilePath: string | undefined, options: { output: string | null, optimizeSpeed: boolean }) { const dirname = process.cwd(); let jsSource: string = ''; let elmFilePath = undefined; - const options = program.opts(); const replacements = null; const o3Enabled = options.optimizeSpeed; @@ -123,5 +122,5 @@ async function run(inputFilePath: string | undefined) { } } - -run(program.args[0]).catch((e) => console.error(e)); +const { output, optimizeSpeed } = program.opts(); +run(program.args[0], { output, optimizeSpeed }).catch((e) => console.error(e));