ghurl

1.1.0 • Public • Published

ghurl

A CLI for fetching data straight from the GitHub API

Installation

npm install ghurl --global

Usage

The first time you run the CLI, it will use ghauth to create a GitHub API token for you. The token is then stored in a file on your machine and used on subsequent requests.

Pagination is handled automatically using ghutils lister, so you'll get all the results for your query:

# everything a user is watching
ghurl users/zeke/subscriptions

# a repo's open issues
ghurl repos/electron/electron.atom.io/issues

# all of a repo's issues (notice the quotes)
ghurl "repos/electron/electron.atom.io/issues?state=all"

The result is JSON to stdout.

For a list of all available endpoints you can use the github-api-endpoints module:

npm i -g github-api-endpoints && github-api-endpoints | grep GET

...or see all the endpoints at developer.github.com/v3/

You can direct the output to a file for inspection, or use tee to pipe it to a file and stdout simultaneously! You can also use json to perform operations on the file right in your shell:

ghurl repos/electron/electron.atom.io/issues | tee issues.json | json -a title

Example Use Case

Say you're watching too many GitHub repos and you want to unfollow a bunch of them at once. You can do this on the website but it requires a great deal of click-click-clicking. 🐁

First, collect the names of all the repos you're watching:

ghurl users/zeke/subscriptions | json -a full_name > repos.txt

Then edit the file and delete the repos you want to keep watching:

$EDITOR repos.txt

Then install the watch-gh-repos CLI:

npm i -g watch-gh-repos

Then unfollow en masse!

cat repos.txt | xargs -I repo watch-gh-repos --unwatch repo

Dependencies

  • ghauth: Create and load persistent GitHub authentication tokens for command-line apps
  • ghutils: A collection of utility functions for dealing with the GitHub API
  • minimist: parse argument options

Dev Dependencies

None

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i ghurl

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

4.07 kB

Total Files

4

Last publish

Collaborators

  • zeke