@buildo/hophop
Version:

82 lines (54 loc) • 2.74 kB
Markdown
# 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
#### GitHub
- `hophop gh setup` to set the GitHub API access token
- to generate a GitHub token click on the url printed by `hophop` in the terminal 
with that link, the required permissions are already filled: all you need to do is click the green "Generate token" button at the bottom of the page
##### For GitHub Enterprise repos
1. add `.hophoprc` file in repo root folder with a valid "apiUrl" key (ex: `https://my.custom.url/api/v3`)
2. run `hophop gh setup` as usual from inside the repo
#### Toggl
`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.
`hophop gh open` to open on Chrome the PR associated with current branch (if it exists and if it's open).
## Toggl
`hophop toggl start` to start a time entry for an issue (only while on a branch)
`hophop toggl misc` to start a generic time entry titled 'miscellaneous'
`hophop toggl test` to start a time entry titled 'test'
`hophop toggl stop` to stop the current time entry
## .hophoprc
add an optional `.hophoprc` file in your project root folder in order to use default answers to the `hophop gh feature` task questions:
#### example
```
toggl: n // or `no`, or `nope`
branchPrefix: n
branchSuffix: y // or `yes`, or `yep`, or `si`, or `of course`, or `youbetcha`
validBranchPrefixes: // default is "api", "web", "iOS"
- escalapio
- qia
- superweb
```
## 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)
```