jkl

package module
v0.0.0-...-493275c Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2020 License: MIT Imports: 19 Imported by: 0

README

jkl

jkl is a library for programmatically interacting with a JIRA installation. It comes with a command line program (also called jkl) which allows you to interact with JIRA via the command line.

Installation

To use the library, simply import it into your application: import "github.com/otremblay/jkl"

To install the command line application: First, make sure you have a working go environment: https://golang.org/doc/install

Then, execute the following command from your shell:

$ go get github.com/otremblay/jkl/cmd/jkl

Usage

Make sure you create a ~/.jklrc file in your home directory, it should contain at a minimum:

JIRA_ROOT="https://jira.example.com/"
JIRA_USER="myusername"
JIRA_PASSWORD="mypassword"
JIRA_PROJECT="DPK"

Those values are for example only, your setup will be different.

TODO: Finish writing usage instructions

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommentIdSeparator = "~"
View Source
var Verbose *bool

Functions

func AddComment

func AddComment(taskKey string, comment string) error

func Assign

func Assign(taskKey string, user string) error

func Attach

func Attach(issueKey string, filename string) error

func DoTransition

func DoTransition(taskKey string, transitionName string) error

func Edit

func Edit(issue *JiraIssue) error

func EditComment

func EditComment(taskKey string, commentId string, comment *Comment) error

func FindRCFile

func FindRCFile() string

func FlagIssue

func FlagIssue(taskKeys []string, flg bool) error

func LinkIssue

func LinkIssue(params []string) error

func LogWork

func LogWork(taskKey string, workAmount string) error

func PrettySeconds

func PrettySeconds(seconds int) string

Types

type AllowedValue

type AllowedValue struct {
	Id    string `json:"id"`
	Self  string `json:"self"`
	Value string `json:"value"`
	Name  string `json:"name"`
}

func (*AllowedValue) String

func (a *AllowedValue) String() string

type Attachment

type Attachment struct {
	Filename string
	Author   *Author
	Content  string
}

func (*Attachment) String

func (a *Attachment) String() string

type Author

type Author struct {
	Name        string `json:"name"`
	DisplayName string `json:"displayName"`
}

func (*Author) String

func (a *Author) String() string

type Comment

type Comment struct {
	Id     string  `json:"id"`
	Author *Author `json:"author"`
	Body   string  `json:"body"`
}

func GetComment

func GetComment(taskKey string, commentId string) (*Comment, error)

type CommentColl

type CommentColl struct {
	Comments []Comment
}

type CreateMeta

type CreateMeta struct {
	Projects []*Project
}

func GetCreateMeta

func GetCreateMeta(projectKey, issueType string) (*CreateMeta, error)

type EditMeta

type EditMeta struct {
	Fields map[string]*FieldSpec
}

type FieldSpec

type FieldSpec struct {
	Name     string
	Required bool
	Schema   struct {
		Type     string
		Custom   string
		CustomId int
		Items    string
	}
	Operations    []string
	AllowedValues []*AllowedValue
}

type Fields

type Fields struct {
	*IssueType   `json:"issuetype,omitempty"`
	Assignee     *Author       `json:",omitempty"`
	Project      *Project      `json:"project,omitempty"`
	Summary      string        `json:"summary,omitempty"`
	Description  string        `json:"description,omitempty"`
	Comment      *CommentColl  `json:"comment,omitempty"`
	Parent       *JiraIssue    `json:",omitempty"`
	Status       *Status       `json:",omitempty"`
	TimeTracking *TimeTracking `json:"timetracking,omitempty"`
	Attachment   []*Attachment `json:"attachment,omitempty"`
	IssueLinks   []*IssueLink  `json:"issueLinks,omitempty"`
	Priority     *Priority     `json:",omitempty"`
	Worklog      *Worklogs     `json:"worklog,omitempty"`

	ExtraFields map[string]interface{} `json:"-"`
	// contains filtered or unexported fields
}

func (*Fields) PrettyOriginalEstimate

func (f *Fields) PrettyOriginalEstimate() string

func (*Fields) PrettyRemaining

func (f *Fields) PrettyRemaining() string

func (*Fields) UnmarshalJSON

func (f *Fields) UnmarshalJSON(b []byte) error
type IssueLink struct {
	LinkType     *LinkType `json:"type"`
	InwardIssue  *JiraIssue
	OutwardIssue *JiraIssue
}

func (*IssueLink) String

func (i *IssueLink) String() string

type IssueType

type IssueType struct {
	Name    string `json:"name"`
	IconURL string `json:",omitempty"`
	Fields  map[string]*FieldSpec
}

func (*IssueType) RangeFieldSpecs

func (it *IssueType) RangeFieldSpecs() string

type JiraClient

type JiraClient struct {
	*http.Client
	// contains filtered or unexported fields
}

func NewJiraClient

func NewJiraClient(jiraRoot string) *JiraClient

func (*JiraClient) Do

func (j *JiraClient) Do(req *http.Request) (*http.Response, error)

func (*JiraClient) DoEvenLess

func (j *JiraClient) DoEvenLess(req *http.Request) (*http.Response, error)

func (*JiraClient) DoLess

func (j *JiraClient) DoLess(req *http.Request) (*http.Response, error)

func (*JiraClient) Get

func (j *JiraClient) Get(path string) (*http.Response, error)

func (*JiraClient) Post

func (j *JiraClient) Post(path string, payload io.Reader) (*http.Response, error)

func (*JiraClient) Put

func (j *JiraClient) Put(path string, payload io.Reader) (*http.Response, error)

type JiraIssue

type JiraIssue struct {
	Key         string        `json:"key,omitempty"`
	Fields      *Fields       `json:"fields,omitempty"`
	Transitions []*Transition `json:"transitions,omitempty"`
	EditMeta    *EditMeta     `json:"editmeta,omitempty"`
}

func Create

func Create(issue *JiraIssue) (*JiraIssue, error)

func GetIssue

func GetIssue(taskKey string) (*JiraIssue, error)

func List

func List(jql string) ([]*JiraIssue, error)

func (*JiraIssue) MarshalJSON

func (i *JiraIssue) MarshalJSON() ([]byte, error)

func (*JiraIssue) PrintExtraFields

func (i *JiraIssue) PrintExtraFields() string

func (*JiraIssue) String

func (i *JiraIssue) String() string

func (*JiraIssue) URL

func (i *JiraIssue) URL() string

func (*JiraIssue) UnmarshalJSON

func (i *JiraIssue) UnmarshalJSON(b []byte) error

type LinkType

type LinkType struct {
	Id      string
	Name    string
	Inward  string
	Outward string
}

type Priority

type Priority struct {
	Name string
}

type Project

type Project struct {
	Key        string `json:"key,omitempty"`
	Name       string
	IssueTypes []*IssueType
}

type Schema

type Schema struct {
	System   string
	Custom   string
	CustomId int
}
type Search struct {
	Issues []*JiraIssue `json:"issues"`
}

type Status

type Status struct {
	Name    string
	IconURL string `json:",omitempty"`
}

type TimeTracking

type TimeTracking struct {
	OriginalEstimateSeconds  int
	RemainingEstimateSeconds int
}

type Transition

type Transition struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

type Worklog

type Worklog struct {
	Author           *Author
	Comment          string
	TimeSpent        string
	TimeSpentSeconds int
	Started          string
}

func (*Worklog) String

func (w *Worklog) String() string

type Worklogs

type Worklogs struct {
	Worklogs []*Worklog `json:",omitempty"`
}

Directories

Path Synopsis
cmd
jkl

Jump to

Keyboard shortcuts

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