Coder Social home page Coder Social logo

buranko's Introduction

buranko

Build Status

A tool for parse a git branch name

Usage

buranko outputs the ID field by default.

$ git checkout -b feature/1234_foo-bar
$ buranko
1234

Specify an output field.

$ buranko -output LinkID
#1234
$ buranko -output Name
foo-bar

Parse a branch name from stdin.

$ echo 'feature/1234_foo-bar' | buranko
1234

Configuration

Configuration uses 'git-config' variables.

buranko.template

The template can use the values defined in the following Fields.

This option is useful for pointing to issues in other GitHub repositories, or for software that requires a prefix in the issue number.

$ git checkout -b feature/1234_foo-bar
$ git config buranko.template ABC-{{.ID}}
$ buranko -template
ABC-1234
$ git config buranko.template foo-org/bar-repo#{{.ID}}
$ buranko -template
foo-org/bar-repo#1234

Fields

  • FullName: Full branch name
  • Action: Action type
  • ID: Issue ID
  • LinkID: Issue ID with a leading #
  • Description: Description

Parse patterns

feature/1234_foo-bar

  • FullName: feature/1234_foo-bar
  • Action: feature
  • ID: 1234
  • LinkID: #1234
  • Description: foo-bar

foo-bar

  • FullName: foo-bar
  • Description: foo-bar

More patterns at parser_test.go.

Integrate with prepare-commit-msg

Add an issue ID to commit comment using git hook.

GIT-REPO/.git/hooks/prepare-commit-msg

if [ "$2" == "" ]; then
    mv $1 $1.tmp
    echo `buranko -output LinkID -template` > $1
    cat $1.tmp >> $1
fi

Install

To install, use go get:

$ go get github.com/chocoby/buranko

Or you can download a binary from releases page and place it in $PATH directory.

Contribution

  1. Fork (https://github.com/chocoby/buranko/fork)
  2. Create a feature branch
  3. Commit your changes
  4. Rebase your local changes against the master branch
  5. Run test suite with the go test ./... command and confirm that it passes
  6. Run gofmt -s
  7. Create a new Pull Request

GitHub

https://github.com/chocoby/buranko

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.