Skip to content

Commit

Permalink
Merge pull request #12 from jmendiara/bin
Browse files Browse the repository at this point in the history
add cli support
  • Loading branch information
jonschlinkert authored Dec 8, 2017
2 parents 4b88517 + 2948ecf commit 5bfae11
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env node

var gh = require('./');

if (!process.argv[2]) {
process.stderr.write('Error: URL must be provided as first argument\n');
process.exit(1);
}
var res = gh(process.argv[2]);
if (res == null) {
process.stderr.write('Error: Invalid parameter: ' + process.argv[2] + '\n');
process.exit(1);
}
process.stdout.write(JSON.stringify(res, null, 2) + '\n');
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
"files": [
"index.js"
],
"bin": {
"parse-github-url" : "./cli.js"
},
"main": "index.js",
"engines": {
"node": ">=0.10.0"
Expand Down

0 comments on commit 5bfae11

Please sign in to comment.