Socket
Book a DemoInstallSign in
Socket

ghurl

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ghurl

A CLI for fetching data straight from the GitHub API

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 17 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts