Skip to content

Commit

Permalink
Separate all error/information output on stderr for csv output piping
Browse files Browse the repository at this point in the history
  • Loading branch information
fnimick committed May 11, 2022
1 parent 13043c1 commit 4c67db3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions dynamoDBtoCSV.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ program
const options = program.opts();

if (!options.table) {
console.log("You must specify a table");
program.outputHelp();
console.error("You must specify a table");
program.outputHelp({ error: true });
process.exit(1);
}

Expand Down Expand Up @@ -77,7 +77,7 @@ if (options.mfa && options.profile) {
// Update config to include MFA
AWS.config.update({ credentials: creds });
} else if (options.mfa && !options.profile) {
console.log('error: MFA requires a profile(-p [profile]) to work');
console.error('error: MFA requires a profile(-p [profile]) to work');
process.exit(1);
}

Expand Down Expand Up @@ -168,9 +168,9 @@ const appendStats = (params, items) => {

const printStats = (stats) => {
if (stats) {
console.log("\nSTATS\n----------");
console.error("\nSTATS\n----------");
Object.keys(stats).forEach((key) => {
console.log(key + " = " + stats[key]);
console.error(key + " = " + stats[key]);
});
writeCount += rowCount;
rowCount = 0;
Expand Down Expand Up @@ -237,8 +237,8 @@ const unparseData = (lastEvaluatedKey) => {
console.log(endData);
}
// Print last evaluated key so process can be continued after stop.
console.log("last key:");
console.log(lastEvaluatedKey);
console.error("last key:");
console.error(lastEvaluatedKey);

// reset write array. saves memory
unMarshalledArray = [];
Expand Down

0 comments on commit 4c67db3

Please sign in to comment.