Skip to content

Commit

Permalink
Merge pull request #21 from 5-gwoap/release-0.2.0
Browse files Browse the repository at this point in the history
Release 0.2.0
  • Loading branch information
rainrivas authored Jan 15, 2018
2 parents 2bcbf5e + 115a4e3 commit 271bd3a
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 16 deletions.
22 changes: 22 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Contributing

Slng-node is an open source project and we're always looking to make our product better. Feel free to browse our [issues](https://github.com/5-gwoap/slng-node/issues) for a fix/enhancement you may be interested in helping out with.

#### New Issues
If you see a current issue or have a feature request, please create an issue and let us know! If you already see a great solution, let's have a discussion about it and figure it out.

#### Branch Names
Try to keep branch names following the following format:

`slng-<issue number>-topic`

ie: `slng-16-add-contributing-guidelines`

#### Pull Requests
When you have done some work and please send the PR against development and comment/link it to the issue you have a suggested fix for.

#### tl;dr
1. Read through issues
2. Open issue
3. Fork this project
4. Send PR to development
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,9 @@ slng <search string>

slng will return (up to) the first 3 results by default.


#### Contributing
If you see an issue with slng, feel free to create an issue for review. If we can reproduce the issue, we'll flag the ticket. Check out the rest of our [contributing guidelines](./CONTRIBUTING.md) for more information.

### License
[MIT](https://github.com/5-gwoap/slng-node/blob/master/LICENSE)
29 changes: 18 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/usr/bin/env node

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

program
.arguments('<slng>')
.version('0.2.0')
.arguments('<phrase>')
.action((slng) => {
var options = {
method: 'GET',
Expand All @@ -22,16 +24,21 @@ program
if (err) throw new Error(err);
var trimRes;
var results = JSON.parse(body).list;
if (results.length > 3) {
trimRes = results.slice(0, 3);
} else {
trimRes = results;
if (results.length === 0 ) {
console.log(chalk.red('No results were found, please try another phrase'));
}
trimRes.forEach((result) => {
if (typeof (result.definition) !== undefined) {
console.log("=======================\n" + result.definition);
else {
if (results.length > 3) {
trimRes = results.slice(0, 3);
} else {
trimRes = results;
}
});
trimRes.forEach((result) => {
if (typeof (result.definition) !== undefined) {
console.log(chalk.bold.cyan('=======================\n') + result.definition);
}
});
}
});
})
.parse(process.argv);
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.

20 changes: 16 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "slng",
"version": "0.1.3",
"version": "0.2.0",
"description": "Get hip or die trying",
"main": "index.js",
"scripts": {
Expand All @@ -11,12 +11,23 @@
"url": "git+https://github.com/5-gwoap/slng-node"
},
"keywords": [
"slng",
"node",
"chat",
"cli",
"cool",
"define",
"definition",
"dictionary",
"get-hip",
"hip",
"informal",
"lookup",
"node",
"npm",
"search",
"slang",
"slng",
"urban",
"dictionary"
"urban-dictionary"
],
"author": "Efrain 'Rain' Rivas",
"license": "MIT",
Expand All @@ -28,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 271bd3a

Please sign in to comment.