Skip to content

Commit

Permalink
fix(cli): pass additional params to transformFile
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharmath committed Jul 14, 2018
1 parent c43e188 commit e632ca4
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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
Expand All @@ -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))
Expand Down

0 comments on commit e632ca4

Please sign in to comment.