Skip to content

Commit

Permalink
Slng 5 add color to output (#18)
Browse files Browse the repository at this point in the history
* Setting up chalk support

* Adding red to errors and adding cyan to the divider. Keeping the definition in white
  • Loading branch information
rainrivas authored and jwu910 committed Jan 14, 2018
1 parent d6aaeed commit 99a02c0
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 5 deletions.
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env node

var program = require('commander'),
request = require('request');
const chalk = require('chalk');
const program = require('commander');
const request = require('request');

program
.version('0.1.4')
Expand All @@ -24,7 +25,7 @@ program
var trimRes;
var results = JSON.parse(body).list;
if (results.length === 0 ) {
console.log('No results were found, please try another phrase');
console.log(chalk.red('No results were found, please try another phrase'));
}
else {
if (results.length > 3) {
Expand All @@ -34,7 +35,7 @@ program
}
trimRes.forEach((result) => {
if (typeof (result.definition) !== undefined) {
console.log('=======================\n' + result.definition);
console.log(chalk.bold.cyan('=======================\n') + result.definition);
}
});
}
Expand Down
51 changes: 50 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"slng": "./index.js"
},
"dependencies": {
"chalk": "^2.3.0",
"commander": "^2.12.2",
"request": "^2.83.0"
}
Expand Down

0 comments on commit 99a02c0

Please sign in to comment.