mirror of
https://github.com/all-contributors/cli.git
synced 2025-01-09 21:46: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>
|
# 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:
|
Where:
|
||||||
- `username` is the user's GitHub username
|
- `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
|
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.
|
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification.
|
||||||
Contributions of any kind welcome!
|
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 defaultEmojis = require('./lib/emoji');
|
||||||
var addContributor = require('./lib/addContributor');
|
var addContributor = require('./lib/addContributor');
|
||||||
|
|
||||||
var defaultRCFile = '.all-contributorsrc';
|
var cwd = process.cwd();
|
||||||
|
var defaultRCFile = path.join(cwd, '.all-contributorsrc');
|
||||||
|
|
||||||
var argv = require('yargs')
|
var argv = require('yargs')
|
||||||
.command('add', 'add a new contributor')
|
.command('add', 'add a new contributor')
|
||||||
|
@ -22,7 +23,7 @@ var argv = require('yargs')
|
||||||
try {
|
try {
|
||||||
return JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
return JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (configPath !== path.join(__dirname, defaultRCFile)) {
|
if (configPath !== defaultRCFile) {
|
||||||
console.error(error.message);
|
console.error(error.message);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
@ -35,7 +36,7 @@ var argv = require('yargs')
|
||||||
argv.emoji = assign({}, defaultEmojis, argv.emoji);
|
argv.emoji = assign({}, defaultEmojis, argv.emoji);
|
||||||
argv.username = argv._[1];
|
argv.username = argv._[1];
|
||||||
argv.contributions = argv._[2].split(',');
|
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) {
|
getUserInfo(argv.username, function(error, user) {
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
"name": "all-contributors-cli",
|
"name": "all-contributors-cli",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Tool to easily add recognition for new contributors",
|
"description": "Tool to easily add recognition for new contributors",
|
||||||
"bin": "cli.js",
|
"bin": {
|
||||||
|
"all-contributors": "cli.js"
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "ava lib/**/*.test.js",
|
"test": "ava lib/**/*.test.js",
|
||||||
"test:w": "npm test -- --watch"
|
"test:w": "npm test -- --watch"
|
||||||
|
|
Loading…
Reference in a new issue