mirror of
https://github.com/all-contributors/cli.git
synced 2025-01-09 13:36:29 +00:00
Fix README example & cli config reading
This commit is contained in:
parent
77e6c4e556
commit
62ae9d3ef0
3 changed files with 11 additions and 6 deletions
|
@ -6,7 +6,9 @@ This is a tool to help automate adding contributor acknowledgements according to
|
|||
|
||||
```
|
||||
# Add new contributor <username>, who a contribution of type <contribution>
|
||||
all-contributors <username> <contribution>
|
||||
all-contributors add <username> <contribution>
|
||||
# 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)<br />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)<br />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!
|
||||
|
|
7
cli.js
7
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) {
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue