jiraf

command module
v0.0.0-...-ae29f22 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: MIT Imports: 7 Imported by: 0

README

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) }'

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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