From e632ca4c99c12b205dd372e6f027add1b51fd8a7 Mon Sep 17 00:00:00 2001 From: Tushar Mathur Date: Sat, 14 Jul 2018 22:05:35 +0530 Subject: [PATCH] fix(cli): pass additional params to transformFile --- src/cli.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index aca66dc..358c14c 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -5,7 +5,7 @@ import {transformFile} from './transform-file' const LOG = console.log -const {transformation, write, _: sourceFiles} = yargs +const {transformation, write, _: sourceFiles, param} = yargs .usage('Usage: $0 -t [transformation-name] [glob pattern]') .option('write', { alias: 'w', @@ -18,8 +18,7 @@ const {transformation, write, _: sourceFiles} = yargs }) .option('param', { alias: 'p', - describe: 'Transformation specific params', - demandOption: true + describe: 'Transformation specific params' }) .boolean('w') .string('t').argv @@ -31,11 +30,10 @@ async function main() { const {default: transformationFunction} = await import(transformationPath) const createSourceFile = async (path: string) => { - const params = {write, path} const {content} = await transformFile( transformationFunction, - params, - yargs.argv + {write, path}, + param ) LOG(chalk.green(path)) if (!write) LOG(chalk.white(content))