gong

package module
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2019 License: MIT Imports: 12 Imported by: 1

README

Gong

Build Status
  • Develop: Build Status
  • Master : Build Status

Summary

Gong is a CLI to make working with an issue tracker (look at the supported clients) and still keeping your flow going in the terminal.

You can easily start branches off of issues, comment and also link commits to the issue URL.

Usage

Installation

Head over to the Github releases. The latest releases all have executables for OSX and linux.

I did not test gong on windows so if you want to build for windows and test, please let me know.

Once you download the latest release, put it in your PATH and you can now use gong

Currently supported clients
  • Jira

If you would like to contribute a different client, please feel free to submit a PR

Login

In order to use gong you first you need to login.

gong login {client-name}

Each of the supported clients will prompt the required fields in order to login to the system. Jira will need username, pass and a couple more while others might only need an API token.

Once you input all of the details the client will attempt to login. If succeeded it will let you know.

asciicast

Start working on an issue

gong start {issue-id} --type feature

If you want to start working on an issue, you can type in gong start with the issue id and what type of work is this (defaults to feature).

This will do a couple of things

  1. Create a branch name {type}/{issue-id}-{issue-title-sluggified}
  2. Transition the issue to a started state

asciicast

gong browse

While working on a branch that matches the gong regular expression (look above), you can type gong browse and it will open up a browser opened on the issue automatically.

gong comment

While working on a branch that matches the gong regular expression, you can type echo "comment" | gong comment and it will send a comment on the ticket.

Why a pipe?

The reason for choosing a pipe and not just have the comment as an argument is to have the ability to send any output to the comment.

What I find most useful is to send diffs, files, buffers from vim and more.

With this approach, I find I write much better comments to tickets. You will do the same :)

asciicast](https://asciinema.org/a/d0rcjavbv55lbq1xpsrqiyyu6)

gong prepare-commit-message

This is not meant to be used directly, instead it is meant to be wrapped with simple wrapper git hooks.

Sample hooks can be found in git-hooks directory.

All you need to do is to copy them into your .git/hooks directory.

This will add a link to the issue to every commit. Whether you do git commit "commit message" or edit the commit message using the editor with git commit`

Install commit hooks on your repository
curl https://raw.githubusercontent.com/KensoDev/gong/develop/git-hooks/prepare-commit-msg > .git/hooks/prepare-commit-msg
chmod +x .git/hooks/prepare-commit-msg

curl https://raw.githubusercontent.com/KensoDev/gong/develop/git-hooks/commit-msg > .git/hooks/commit-msg
chmod +x .git/hooks/commit-msg
gong create

Gong create will open the browser on the issue tracker create ticket flow. You can then copy over the issue-id and run gong start which will create the branch and you cn start working on your ticket.

Issues/Feedback

If you have any issues, please open one here on Github or hit me up on twitter @KensoDev

CHANGELOG

1.6.0

  • Added transitions to the config and outputting the transitions to STDout to verify the config.

1.4.0

  • Added the pivotal tracker client. Thanks to @stephensxu. In order to create the client and connect to pivotal tracker, you run gong login pivotal
1.3.4
  • Added the create command. Opens up the browser on the create ticket URL for the specific issue tracker

Upcoming features

gong slack

Send a message to a slack channel, tagging the issue you are working on

gong next/pick

Show you the next items on your backlog, be able to start one without opening the browser

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Browse added in v1.2.0

func Browse(client Client, branchName string) (string, error)

Browse : Open a browser on the issue related to the branch

func Comment added in v1.2.0

func Comment(client Client, branchName, comment string) error

Comment : Comment on an issue

func Create added in v1.7.0

func Create(client Client) (string, error)

func GetIssueID added in v1.7.0

func GetIssueID(branchName string) string

GetIssueID : returns the issue id from a branch name

func GetPivotalIssueID added in v1.7.0

func GetPivotalIssueID(branchName string) string

func Load

func Load() (map[string]string, error)

Load : Load the configuration from a file

func Login added in v1.2.0

func Login(client Client) (bool, error)

Login : Logs the user into the specified client

func PrepareCommitMessage added in v1.7.0

func PrepareCommitMessage(client Client, branchName, commitMessage string) string

PrepareCommitMessage : Prepares the commit message and returns a new commit message

func Save added in v1.2.0

func Save(values map[string]string) error

Save : saves the configuration to a file

func SlugifyTitle

func SlugifyTitle(ticketTitle string) string

SlugifyTitle : Make sure to clean up the branch names

func Start added in v1.2.0

func Start(client Client, issueType, issueID string) (string, error)

Start : Start working on an issue

Types

type Client added in v1.2.0

type Client interface {
	GetAuthFields() map[string]bool
	GetName() string
	FormatField(fieldName string, value string) string
	Authenticate(fields map[string]string) bool
	Start(issueType string, issueID string) (branchName string, err error)
	Browse(branchName string) (string, error)
	Comment(branchName, comment string) error
	PrepareCommitMessage(branchName, commitMessage string) string
	Create() (string, error)
}

Client : Public interface for the generic client

func NewAuthenticatedClient added in v1.2.0

func NewAuthenticatedClient() (Client, error)

NewAuthenticatedClient : Return a new client authenticated

func NewClient added in v1.2.0

func NewClient(clientName string) (Client, error)

NewClient : Return a new client that matches the name passed in

type JiraClient added in v1.2.0

type JiraClient struct {
	// contains filtered or unexported fields
}

JiraClient : Struct implementing the generic Client interface

func NewJiraClient added in v1.2.0

func NewJiraClient() *JiraClient

NewJiraClient : Returns a pointer to JiraClient

func (*JiraClient) Authenticate added in v1.2.0

func (j *JiraClient) Authenticate(fields map[string]string) bool

Authenticate : Authenticates using the fields passed in

func (*JiraClient) Browse added in v1.2.0

func (j *JiraClient) Browse(branchName string) (string, error)

Browse : Browse to the URL of the issue related to the branch name

func (*JiraClient) Comment added in v1.2.0

func (j *JiraClient) Comment(branchName, comment string) error

Comment : Post a comment on a jira issue

func (*JiraClient) Create added in v1.7.0

func (j *JiraClient) Create() (string, error)

Create will create a new client

func (*JiraClient) FormatField added in v1.2.0

func (j *JiraClient) FormatField(fieldName string, value string) string

FormatField : Returns a formatted field based on internal rules

func (*JiraClient) GetAuthFields added in v1.2.0

func (j *JiraClient) GetAuthFields() map[string]bool

GetAuthFields : Get a map of auth fields

func (*JiraClient) GetBranchName added in v1.2.0

func (j *JiraClient) GetBranchName(issueType string, issueID string) (string, error)

GetBranchName : Return the branch name from the issue id and issue type

func (*JiraClient) GetDomain added in v1.7.0

func (j *JiraClient) GetDomain() (string, error)

GetDomain : Get the domain from the config

func (*JiraClient) GetName added in v1.2.0

func (j *JiraClient) GetName() string

GetName : Return the string name of the struct eg: jira

func (*JiraClient) PrepareCommitMessage added in v1.7.0

func (j *JiraClient) PrepareCommitMessage(branchName, commitMessage string) string

PrepareCommitMessage : Returns a string with the issue id in the link

func (*JiraClient) Start added in v1.2.0

func (j *JiraClient) Start(issueType string, issueID string) (string, error)

Start : Start an issue

type PivotalClient added in v1.7.0

type PivotalClient struct {
	// contains filtered or unexported fields
}

PivotalClient : Struct implementing the generic Client interface

func NewPivotalClient added in v1.7.0

func NewPivotalClient() *PivotalClient

NewPivotalClient : Returns a pointer to PivotalClient

func (*PivotalClient) Authenticate added in v1.7.0

func (p *PivotalClient) Authenticate(fields map[string]string) bool

Authenticate : Authenticates using the fields passed in

func (*PivotalClient) Browse added in v1.7.0

func (p *PivotalClient) Browse(branchName string) (string, error)

Browse : Browse to the URL of the issue related to the branch name

func (*PivotalClient) Comment added in v1.7.0

func (p *PivotalClient) Comment(branchName, comment string) error

func (*PivotalClient) Create added in v1.7.0

func (p *PivotalClient) Create() (string, error)

func (*PivotalClient) FormatField added in v1.7.0

func (p *PivotalClient) FormatField(fieldName string, value string) string

FormatField : Returns a formatted field based on internal rules

func (*PivotalClient) GetAuthFields added in v1.7.0

func (p *PivotalClient) GetAuthFields() map[string]bool

func (*PivotalClient) GetBranchName added in v1.7.0

func (p *PivotalClient) GetBranchName(issueType string, issueID string) (string, error)

func (*PivotalClient) GetName added in v1.7.0

func (p *PivotalClient) GetName() string

GetName : Return the string name of the struct eg: pivotal

func (*PivotalClient) GetProjectIdAndIssueId added in v1.7.0

func (p *PivotalClient) GetProjectIdAndIssueId(issueID string) (int, int, error)

func (*PivotalClient) PrepareCommitMessage added in v1.7.0

func (p *PivotalClient) PrepareCommitMessage(branchName, commitMessage string) string

func (*PivotalClient) Start added in v1.7.0

func (p *PivotalClient) Start(issueType string, issueID string) (string, error)

Start : Start an issue

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL