Giter VIP home page Giter VIP logo

jiraf's Introduction

Jiraf

Jiraf finds an issue in Jira by key and generates a git branch name from its summary.

gif

Installation

Git

cd /tmp
git clone https://github.com/ivaaaan/jiraf.git
cd jiraf
go install

Configuration

Configuration file stored in ~/.config/jiraf/config.yml in the YAML format.

url: <url to your Jira>
username: <username>
password: <Jira API token>
format: <format for fmt.Sprintf, the first argument is an issue key, the second one is generated summary>
pipeline:
  <function>: [<arguments>...]
  ...

Example

url:  <url to your Jira>
username: <username>
password: <Jira api token>
format: "%s_%s"
pipeline:
  replace: [' ', '-']
  replace_regexp: ['[^a-zA-Z0-9-]+', '']
  to_lower:

This configuration will generate a branch name like this: ISSUE-1_summary-of-your-issue

Pipeline

Pipeline is a set of functions with arguments. Each of the function will be called on a result from a previous function.

Available functions:

Name Arguments Description
to_lower Convert a string to lowercase
replace old, new Replace all old with new
replace_regexp regexp, new Replace all characters that match regexp with new

Usage

Git subcommand

One way to integrate jiraf with git is to create a simple script like this:

#!/bin/bash

git checkout -b $(jiraf $1)

And put this script into ~/bin/git-cb file (replace "cb" with a preferred subcommand name). Now you can just run git cb ISSUE-1, which will create a new branch with a generated name by jiraf.

Alias

Another one is an alias:

alias gcb='() { git checkout -b $(jiraf $1) }'

jiraf's People

Contributors

ivaaaan avatar janisz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

jiraf's Issues

Wrong number of parameters

I'm trying to use the command as simple as this: jiraf PROJECT-123 and it doesn't work.

I have this error:

jiraf/main.go

Lines 56 to 57 in 4966328

if len(os.Args) != 1 {
log.Fatal("expected single argument, a ticket id (e.g., PROJECT-123")

Usually, the executable filename is included in the list of arguments in other languages, maybe it's the same with go. And maybe you have never tested your CLI while being installed? Idk

Installation instructions

I had to do GOBIN=/usr/local/bin/ go install to have jiraf installed as a global cli.

Maybe you should update your README :)

(I don't know go).

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.