Skip to content

Commit

Permalink
feat(bin): use console.dir with colors on tty, JSON otherwise
Browse files Browse the repository at this point in the history
  • Loading branch information
gadicc committed Jan 29, 2021
1 parent beba214 commit 6db79e5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bin/yahoo-finance.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,9 @@ function decodeArgs(stringArgs) {

const yahooFinance = new YahooFinance();
const result = await yahooFinance[moduleName](...args);
console.log(result);

if (process.stdout.isTTY)
console.dir(result, { depth: null, colors: true });
else
console.log(JSON.stringify(result, null, 2));
})();

0 comments on commit 6db79e5

Please sign in to comment.