Skip to content
This repository has been archived by the owner on Jan 25, 2021. It is now read-only.

Latest commit

 

History

History
69 lines (53 loc) · 3.65 KB

README.md

File metadata and controls

69 lines (53 loc) · 3.65 KB

Archived now that GitHub has released their own CLI

github.fish

A plugin for the fish-shell.

MIT License Fish Shell Version Oh My Fish Framework


Navigate to the GitHub pages for your branches from the command line! Say that you are working with a remote repository called Repo that is owned by Org. And you are on a branch called branch for which a PR has been created with id 32. github.fish provides a shortcut to open the current branch's

in your browser. Should work on macOS and Linux.

Install

Basic installation

If you only want to be able to open the tree view for the current branch on GitHub, you only need to install the plugin.

With fisher

fisher add patrickf1/github.fish

With Oh My Fish

omf install https://github.com/patrickf1/github.fish

Installing open PR functionality

If you want to be able to open the pull request created for the current branch on GitHub, you will need to do a bit more set up. The first step is to obtain a GitHub Personal Access token and set it as an environment variable. This is needed because github.fish queries the GitHub API to get information about your repositories' pull requests. See the section below for further instructions. The second is to install gron, which is used to parse the JSON returned by GitHub's API:

brew install gron

Providing GitHub Credentials

Follow GitHub's directions for creating a personal access token here. These are the minimal permissions the token will need:

token permissions

If you work with repositories protected by SSO, make sure you follow step 10. Or see the directions here.

After you have obtained a token, assign it to the environment variable GITHUB_AUTH_TOKEN like so in your config.fish (or similar) so that github.fish can access it:

set -x GITHUB_AUTH_TOKEN <insert token here>

Usage

The github command only works when your working directory is a git repository that has a GitHub upstream configured. To open the tree view for the current branch, run

github

If GitHub 404s, make sure you have pushed the current branch.

To open the pull request for the current branch, run

github --pr

If the command fails, double check that your access token is valid and that a pull request has been opened for the current branch. Note that if multiple pull requests have been created for the current branch, the latest PR will be used.

Think you've found a bug? Please run in debug mode with the -d flag and open an issue with the debug log.