bin/src/cli-main.js
function marge(args) {
  // Reset valid files count
  validFiles = 0;

  // Get the array of JSON files to process
  const files = processArgs(args._);

  // When there are multiple valid files OR the timestamp option is set
  // we must force `overwrite` to `false` to ensure all reports are created
  /* istanbul ignore else */
  if (validFiles > 1 || args.timestamp !== false) {
    args.overwrite = false;
  }

  const promises = files.map(file => {
    // Files with errors we just resolve
    if (file.err) {
      return Promise.resolve(file);
    }

    // Valid files get created but first we need to pass correct filename option
    // Default value is name of file

    // If a filename option was provided, all files get that name
    const reportFilename = getReportFilename(file, args);
    return report.create(file.data, Object.assign({}, args, { reportFilename }));
  });

  return Promise.all(promises)
    .then(handleResolved)
    .catch(handleError);
}
function marge(args) {
  // Reset valid files count
  validFiles = 0;

  // Get the array of JSON files to process
  const files = processArgs(args._);

  // When there are multiple valid files OR the timestamp option is set
  // we must force `overwrite` to `false` to ensure all reports are created
  /* istanbul ignore else */
  if (validFiles > 1 || args.timestamp !== false) {
    args.overwrite = false;
  }

  const promises = files.map(file => {
    // Files with errors we just resolve
    if (file.err) {
      return Promise.resolve(file);
    }

    // Valid files get created but first we need to pass correct filename option
    // Default value is name of file

    // If a filename option was provided, all files get that name
    const reportFilename = getReportFilename(file, args);
    return report.create(file.data, Object.assign({}, args, { reportFilename }));
  });

  return Promise.all(promises)
    .then(handleResolved)
    .catch(handleError);
}
function marge ( args ) { // Reset valid files count validFiles = 0 ; // Get the array of JSON files to process const files = processArgs ( args . _ ) ; // When there are multiple valid files OR the timestamp option is set // we must force `overwrite` to `false` to ensure all reports are created /* istanbul ignore else */ if ( validFiles > 1 || args . timestamp !== false ) { args . overwrite = false ; } const promises = files . map ( file => { // Files with errors we just resolve if ( file . err ) { return Promise . resolve ( file ) ; } // Valid files get created but first we need to pass correct filename option // Default value is name of file // If a filename option was provided, all files get that name const reportFilename = getReportFilename ( file , args ) ; return report . create ( file . data , Object . assign ( { } , args , { reportFilename } ) ) ; } ) ; return Promise . all ( promises ) . then ( handleResolved ) . catch ( handleError ) ; }
Main CLI Program

@param {Object} args CLI arguments

@return {Promise} Resolved promises with saved files or errors
Main CLI Program