Skip to content

Commit

Permalink
merge command & config's output options
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnylost committed Sep 1, 2017
1 parent 0c85e2c commit 0ffac58
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions bin/src/run/mergeOptions.js
Expand Up @@ -73,14 +73,21 @@ export default function mergeOptions ( config, command ) {
paths: getOption('paths')
};

const outputOptions = (
(command.output || config.output) ?
let mergedOutputOptions;
if (Array.isArray(config.output)) {
mergedOutputOptions = config.output.map((output) => Object.assign({}, output, command.output));
} else if (config.output && command.output) {
mergedOutputOptions = [Object.assign({}, config.output, command.output)];
} else {
mergedOutputOptions = (command.output || config.output) ?
ensureArray(command.output || config.output) :
[{
file: command.output ? command.output.file : null,
format: command.output ? command.output.format : null
}]
).map(output => {
}];
}

const outputOptions = mergedOutputOptions.map(output => {
return Object.assign({}, baseOutputOptions, output);
});

Expand Down

0 comments on commit 0ffac58

Please sign in to comment.