Skip to content

Commit

Permalink
Generalizo salida de stats para cli
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoefe committed Nov 7, 2016
1 parent e9094e1 commit 230c77e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions bin/txt-to-sql-run.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ function doGenerate(params, inputYaml, inputName) {
return txtToSql.generateScripts(preparedParams);
}).then(function(result) {
if(result.errors) { throw new Error(result.errors); }
params.stats = result.stats;
return fs.writeFile(outSQL, result.rawSql);
}).then(function() {
process.stdout.write("Generated '"+outSQL+"'")
Expand Down Expand Up @@ -150,19 +151,20 @@ Promises.start(function() {
}).then(function(rawInput) {
params.rawTable = rawInput;
if(cmdParams.fast) {
var result;
return fast.doFast(params, inputBase, fastBufferingThreshold).then(function(res) {
result = res;
return writeConfigYaml(createParams(params, result.preparedResult), inputBase+'.yaml');
return writeConfigYaml(createParams(params, res.preparedResult), inputBase+'.yaml');
}).then(function() {
process.stdout.write("Generated '"+inputBase+".sql'");
process.stdout.write("\n"+txtToSql.stringizeStats(result.stats));
});
} else if (cmdParams.prepare) {
return doPrepare(params, inputYaml);
} else {
return doGenerate(params, inputYaml, inputBase);
}
}).then(function() {
if(params.stats) {
process.stdout.write("\n"+txtToSql.stringizeStats(params.stats));
}
});
}
}).catch(function(err) {
Expand Down

0 comments on commit 230c77e

Please sign in to comment.