Skip to content

Instantly share code, notes, and snippets.

@jdx
Created March 17, 2018 04:19
Show Gist options
  • Save jdx/c0489602cfa7b0a4d74e707731419357 to your computer and use it in GitHub Desktop.
Save jdx/c0489602cfa7b0a4d74e707731419357 to your computer and use it in GitHub Desktop.
import {Command} from '@oclif/command'
import axios from 'axios'
export default class Stars extends Command {
static description = 'show the github stars on a repository'
static args = [{name: 'repository', required: true}]
async run() {
const {args} = this.parse(Stars)
const {data: stargazers} = await axios.get(`https://api.github.com/repos/${args.repository}/stargazers`)
for (let s of stargazers) {
this.log(s.login)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment