# Hophop

A minimal tool to accelerate the GitHub workflow from the command line.

## Installation

`npm install -g @buildo/hophop` with a non-ancient version of `npm`

## Config

`hophop gh setup` to set the GitHub API access token

`hophop gh setup {accountName}` to set up the GitHub Enterprise API access token

`hophop toggl setup` to set the Toggl API access token

`hophop toggl install-hooks` to install the toggl git hooks

## GitHub Workflow

`hophop gh feature` to create a local branch referencing an open issue (or, optionally, create a new issue on the fly).

`hophop gh pr` to push the current feature branch and, if needed, open a Pull Request. The name of the pull request will cause GH to auto-close the issue when the PR is merged.

`hophop gh commit` to create a commit that closes an open issue.

## Toggl

`hophop toggl start` to start a time entry for an issue while on a branch

`hophop toggl stop` to stop the current time entry

## zsh autocompletion
After installing the package, an autocompletion file is available at
```
NPM_PREFIX/lib/node_modules/@buildo/hophop/_hophop
```

where `NPM_PREFIX` is usually `/usr/local` and it can be retrieved using `npm prefix -g`

#### Installation using oh-my-zsh
If you use [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh), installing the autocompletion is as easy as:
```bash
mkdir -p ~/.oh-my-zsh/custom/plugins/hophop
ln -s `(npm prefix -g)`/lib/node_modules/@buildo/hophop/_hophop _hophop
```

Then enable the plugin in your `.zshrc`, for example:
```bash
plugins=(git brew hophop)
```
