Skip to content
This repository has been archived by the owner on Oct 17, 2019. It is now read-only.

Commit

Permalink
Minor improvements in variables and output colors
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhijay authored and cmoesel committed Aug 17, 2018
1 parent e3e7e39 commit 819a33d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const shrJSE = require('shr-json-schema-export');
const shrEE = require('shr-es6-export');
const shrFE = require('shr-fhir-export');
const shrJDE = require('shr-json-javadoc');
const shrAE = require('../shr-adl-exporter');
const shrAE = require('../shr-adl-bmm-exporter');
const LogCounter = require('./logcounter');
const SpecificationsFilter = require('./filter');

Expand Down Expand Up @@ -126,9 +126,10 @@ if (filter) {

const failedExports = [];

let cimcoreSpecifications;
if (doCIMCORE) {
try {
var cimcoreSpecifications = {
cimcoreSpecifications = {
'dataElements': [],
'valueSets': [],
'mappings': [],
Expand Down Expand Up @@ -227,6 +228,7 @@ if (doADL) {
shrAE.generateADLtoPath(expSpecifications, configSpecifications, program.out);
} catch (error) {
logger.fatal('Failure in ADL export. Aborting with error message: %s', error);
failedExports.push('shr-adl-bmm-export');
}
} else {
logger.info('Skipping ADL export');
Expand Down Expand Up @@ -374,7 +376,7 @@ logger.info('Finished CLI Import/Export');
const ftlCounter = logCounter.fatal;
const errCounter = logCounter.error;
const wrnCounter = logCounter.warn;
let [errColor, errLabel, wrnColor, wrnLabel, resetColor, ftlLabel] = ['\x1b[32m', 'errors', '\x1b[32m', 'warnings', '\x1b[0m', 'fatal errors'];
let [errColor, errLabel, wrnColor, wrnLabel, resetColor, ftlColor, ftlLabel] = ['\x1b[32m', 'errors', '\x1b[32m', 'warnings', '\x1b[0m', '\x1b[31m', 'fatal errors'];
if (ftlCounter.count > 0) {
// logger.fatal('');
ftlLabel = `fatal errors (${failedExports.join(', ')})`;
Expand All @@ -392,7 +394,7 @@ if (wrnCounter.count > 0) {
const hrend = process.hrtime(hrstart);
console.log('------------------------------------------------------------');
console.log('Elapsed time: %d.%ds', hrend[0], Math.floor(hrend[1]/1000000));
if (ftlCounter.count > 0) console.log('%s%d %s%s', errColor, ftlCounter.count, ftlLabel, resetColor);
if (ftlCounter.count > 0) console.log('%s%d %s%s', ftlColor, ftlCounter.count, ftlLabel, resetColor);
console.log('%s%d %s%s', errColor, errCounter.count, errLabel, resetColor);
console.log('%s%d %s%s', wrnColor, wrnCounter.count, wrnLabel, resetColor);
console.log('------------------------------------------------------------');

0 comments on commit 819a33d

Please sign in to comment.