From 62ae9d3ef09b1bd1b8ed94806d956606d190f1fb Mon Sep 17 00:00:00 2001 From: Jeroen Engels Date: Tue, 1 Mar 2016 00:15:56 +0100 Subject: [PATCH] Fix README example & cli config reading --- README.md | 6 ++++-- cli.js | 7 ++++--- package.json | 4 +++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b276e71..9c4078f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,9 @@ This is a tool to help automate adding contributor acknowledgements according to ``` # Add new contributor , who a contribution of type -all-contributors +all-contributors add +# Example: +all-contributors add jfmengels code,doc ``` Where: - `username` is the user's GitHub username @@ -67,7 +69,7 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds Contributor | Contributions :---: | :---: -[![Jeroen Engels](https://avatars.githubusercontent.com/u/3869412?v=3&s=100)
Jeroen Engels](https://github.com/jfmengels) | [📖💻⚠️](https://github.com/jfmengels/all-contributors-cli/commits?author=jfmengels) +[![Jeroen Engels](https://avatars.githubusercontent.com/u/3869412?v=3&s=100)
Jeroen Engels](https://github.com/jfmengels) | [💻📖⚠️](https://github.com/jfmengels/all-contributors-cli/commits?author=jfmengels) This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome! diff --git a/cli.js b/cli.js index 60f63aa..a86df93 100755 --- a/cli.js +++ b/cli.js @@ -10,7 +10,8 @@ var getUserInfo = require('./lib/github'); var defaultEmojis = require('./lib/emoji'); var addContributor = require('./lib/addContributor'); -var defaultRCFile = '.all-contributorsrc'; +var cwd = process.cwd(); +var defaultRCFile = path.join(cwd, '.all-contributorsrc'); var argv = require('yargs') .command('add', 'add a new contributor') @@ -22,7 +23,7 @@ var argv = require('yargs') try { return JSON.parse(fs.readFileSync(configPath, 'utf-8')); } catch (error) { - if (configPath !== path.join(__dirname, defaultRCFile)) { + if (configPath !== defaultRCFile) { console.error(error.message); process.exit(1); } @@ -35,7 +36,7 @@ var argv = require('yargs') argv.emoji = assign({}, defaultEmojis, argv.emoji); argv.username = argv._[1]; argv.contributions = argv._[2].split(','); -argv.file = path.join(__dirname, argv.file); +argv.file = path.join(cwd, argv.file); getUserInfo(argv.username, function(error, user) { if (error) { diff --git a/package.json b/package.json index fcc5c41..69c2813 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,9 @@ "name": "all-contributors-cli", "version": "1.0.0", "description": "Tool to easily add recognition for new contributors", - "bin": "cli.js", + "bin": { + "all-contributors": "cli.js" + }, "scripts": { "test": "ava lib/**/*.test.js", "test:w": "npm test -- --watch"