Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonschlinkert/gh-stars
API and CLI for getting the stars for one or more GitHub users or organizations.
https://github.com/jonschlinkert/gh-stars
api cli github repos repositories stars
Last synced: 12 days ago
JSON representation
API and CLI for getting the stars for one or more GitHub users or organizations.
- Host: GitHub
- URL: https://github.com/jonschlinkert/gh-stars
- Owner: jonschlinkert
- License: mit
- Created: 2017-09-13T00:08:05.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-13T00:12:49.000Z (about 7 years ago)
- Last Synced: 2024-10-03T13:42:44.337Z (about 1 month ago)
- Topics: api, cli, github, repos, repositories, stars
- Language: JavaScript
- Homepage: https://github.com/jonschlinkert
- Size: 21.5 KB
- Stars: 16
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/contributing.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ccamel - jonschlinkert/gh-stars - API and CLI for getting the stars for one or more GitHub users or organizations. (JavaScript)
README
# gh-stars [![NPM version](https://img.shields.io/npm/v/gh-stars.svg?style=flat)](https://www.npmjs.com/package/gh-stars) [![NPM monthly downloads](https://img.shields.io/npm/dm/gh-stars.svg?style=flat)](https://npmjs.org/package/gh-stars) [![NPM total downloads](https://img.shields.io/npm/dt/gh-stars.svg?style=flat)](https://npmjs.org/package/gh-stars) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/gh-stars.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/gh-stars)
> Get the stars for one or more GitHub users or organizations.
Follow this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), for updates on this project and others.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save gh-stars
```## Usage
**Params**
* `names` **{String|Array}**: One or more GitHub user or organization names.
* `options` **{Options}**
* `returns` **{Promise}****Example**
```js
var stars = require('gh-stars');stars(['doowb', 'jonschlinkert'], {token: 'YOUR_GITHUB_AUTH_TOKEN'})
.then(function(res) {
console.log(res);
})
.catch(console.error)
```## Options
### options.format
**Type:** `String|Function`
**Default:** API defaults to `json`, CLI defaults to `markdown`.
**Description**
The format to use for the returned report. A custom function may be defined, or optionally choose one of the available formats:
* `json` - this is the default when used by API
* `markdown` (or `md`) - returns a markdown table, this is the default when used by CLI
* `raw` - no formatting is applied**Example**
```js
var stars = require('gh-stars');stars(['doowb', 'jonschlinkert'], {token: 'YOUR_GITHUB_AUTH_TOKEN', format: 'md'})
.then(function(res) {
// res would be formatted as markdown
console.log(res);
})
.catch(console.error)
```### options.filter
**Type:** `Function`
**Default:** Filters out private repositories and forks by default.
**Description:** Custom function to filter out repositories from the result.
**Example**
```js
var stars = require('gh-stars');stars(['doowb', 'jonschlinkert'], {
token: 'YOUR_GITHUB_AUTH_TOKEN',
filter: function(repo) {
return repo.name !== 'foo';
}
})
.then(function(res) {
// res would be formatted as markdown
console.log(res);
})
.catch(console.error)
```## CLI
```sh
$ stars [options]
```* `names` - one or more comma-separated user names or orgs
* `dest` - destination path to use, default is `stars.md`**Options**
* `--format` - the [format](#optionsformat) to use.
## Example markdown report
This is a small cross-section of stars for [@doowb's](https://github.com/doowb) repos:
```
| **Stars** | **Name** |
| --- | --- |
| 3408 | assemble |
| 1410 | handlebars-helpers |
| 364 | verb |
| 309 | micromatch |
| 5491 | TOTAL |
```## About
### Related projects
You might also be interested in these projects:
* [gists](https://www.npmjs.com/package/gists): Methods for working with the GitHub Gist API. Node.js/JavaScript | [homepage](https://github.com/jonschlinkert/gists "Methods for working with the GitHub Gist API. Node.js/JavaScript")
* [github-base](https://www.npmjs.com/package/github-base): JavaScript wrapper that greatly simplifies working with GitHub's API. | [homepage](https://github.com/jonschlinkert/github-base "JavaScript wrapper that greatly simplifies working with GitHub's API.")
* [repos](https://www.npmjs.com/package/repos): List all repositories for one or more users or orgs. | [homepage](https://github.com/jonschlinkert/repos "List all repositories for one or more users or orgs.")
* [topics](https://www.npmjs.com/package/topics): Get and update GitHub repository topics. | [homepage](https://github.com/jonschlinkert/topics "Get and update GitHub repository topics.")### Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.
### Building docs
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
To generate the readme, run the following command:
```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```### Running tests
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
```sh
$ npm install && npm test
```### Author
**Jon Schlinkert**
* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)### License
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).***
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on September 12, 2017._