jiraui

package module
v0.0.0-...-1fc6ef5 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2016 License: Apache-2.0 Imports: 15 Imported by: 0

README

go-jira-ui

go-jira-ui is an ncurses command line tool for accessing JIRA.

It is built around the excellent go-jira and termui libraries.

It aims to be similar to familiar tools like vim, tig, and less.

In order to use this, you should configure an 'endpoint' as per the go-jira documentation:

$ cat ~/.jira.d/config.yml
---
endpoint: https://jira.example.com/
user: bob   # if not same as $USER

This should be all that's needed to get going.

Installation

# Make sure you have GOPATH and GOBIN set appropriately first:
# eg:
#   export GOPATH=$HOME/go
#   export GOBIN=$GOPATH/bin
#   mkdir -p $GOPATH
#   export PATH=$PATH:$GOBIN
go get -v github.com/mikepea/go-jira-ui/jira-ui

Features

  • Supply your own JQL queries to view
  • Label view of a given query, to see categorisations easily
  • Sorting of queries; supply your own custom sorts
  • View tickets from the query
  • Drill into sub/blocker/related/mentioned tickets in details view
  • Show open tickets in an Epic.
  • Basic compatibility with go-jira commandline and options loading
  • Label adding/removing
  • Comment, watch, assign and take implemented via :-mode commands

At present, edit will exit after the update. This is a workaround to an implementation issue, being tracked in #8

Usage

jira-ui is intended to mirror the options of go-jira's jira tool, where useful:

jira-ui             # opens up in Query List page. Default interface.
jira-ui ISSUE       # opens up Ticket Show page, with ISSUE loaded
jira-ui ls -q JQL   # opens up Ticket List page, with results of JQL loaded.
jira-ui -h          # help page

Basic keys

Actions:

<enter>      - select query/ticket
L            - Label view (query results page only)
E            - Edit ticket
S            - Select sort order (query results page only)
w            - Watch the selected ticket
W            - Unwatch the selected ticket
v            - Vote for the selected ticket
V            - Remove vote on the selected ticket
N            - Next ticket in results
P            - Previous ticket in results
h            - show help page

Commands (like vim/tig/less):

:comment {single-line-comment} - add a short comment to ticket
:label {labels}                - add labels to selected ticket
:label add/remove {labels}     - add/remove labels to selected ticket
:take                          - assign ticket to self
:assign {user}                 - assign ticket to {user}
:unassign                      - unassign ticket
:watch [add/remove] [watcher]  - watch ticket (optionally as a different user)
:vote                          - vote for the selected ticket
:unvote                        - remove vote for the selected ticket
:view {ticket}                 - display {ticket}
:query {JQL}                   - display results of JQL
:search|so {text}              - quick search for {text} in open tickets
:search-all|sa {text}          - quick search for {text} in all tickets
:spo {project} {text}          - quick search for {text} in open {project} tickets
:spa {project} {text}          - quick search for {text} in all {project} tickets
:help                          - show help page
:<up>                          - select previous command
:quit or :q                    - quit

Searching:

/{regex}                       - search down
?{regex}                       - search up

Navigation:

up/k         - previous line
down/j       - next line
C-f/<space>  - next page
C-b          - previous page
}            - next paragraph/section/fast-move
{            - previous paragraph/section/fast-move
n            - next search match
g            - go to top of page
G            - go to bottom of page
q            - go back / quit
C-c/Q        - quit

Configuration

It is very much recommended to read the go-jira documentation, particularly surrounding the .jira.d configuration directories. go-jira-ui uses this same mechanism, so can be used to load per-project defaults. It also leverages the templating engine, so you can customise the view of both the query output (use 'jira_ui_list' template), and the issue 'view' template.

go-jira-ui reads its own jira-ui-config.yml file in these jira.d directories, as not to pollute the go-jira config. You can add additional queries & sort orderings to the top-level Query page:

$ cat ~/jira.d/jira-ui-config.yml:
sorts:
  - name: "sort by vote count"
    jql:  "ORDER BY votes DESC"
queries:
  - name: "alice assigned"
    jql:  "assignee = alice AND resolution = Unresolved"
  - name: "bob assigned"
    jql:  "assignee = bob AND resolution = Unresolved"
  - name: "unresolved must-do"
    jql:  "labels = 'must-do' AND resolution = Unresolved AND ( project = 'OPS' OR project = 'INFRA')"

Learning JQL is highly recommended, the Atlassian Advanced Searching page is a good place to start.

Documentation

Index

Constants

View Source
const LOG_MODULE = "jiraui"
View Source
const (
	VERSION = "0.4.1"
)

Variables

This section is empty.

Functions

func FetchJiraTicket

func FetchJiraTicket(id string) (interface{}, error)

func HelpTextAsStrings

func HelpTextAsStrings(data interface{}, templateName string) []string

func JiraQueryAsStrings

func JiraQueryAsStrings(query string, templateName string) []string

func JiraTicketAsStrings

func JiraTicketAsStrings(data interface{}, templateName string) []string

func Run

func Run()

func RunExternalCommand

func RunExternalCommand(fn func() error) error

func WrapText

func WrapText(lines []string, maxWidth uint) []string

Types

type BaseInputBox

type BaseInputBox struct {
	EditBox
	// contains filtered or unexported fields
}

func (*BaseInputBox) Create

func (p *BaseInputBox) Create()

func (*BaseInputBox) Id

func (p *BaseInputBox) Id() string

func (*BaseInputBox) Update

func (p *BaseInputBox) Update()

type BaseListPage

type BaseListPage struct {
	ActiveSearch Search
	// contains filtered or unexported fields
}

func (*BaseListPage) BottomOfPage

func (p *BaseListPage) BottomOfPage()

func (*BaseListPage) Create

func (p *BaseListPage) Create()

func (*BaseListPage) Id

func (p *BaseListPage) Id() string

func (*BaseListPage) IsPopulated

func (p *BaseListPage) IsPopulated() bool

func (*BaseListPage) NextLine

func (p *BaseListPage) NextLine(n int)

func (*BaseListPage) NextPage

func (p *BaseListPage) NextPage()

func (*BaseListPage) NextPara

func (p *BaseListPage) NextPara()

func (*BaseListPage) PageLines

func (p *BaseListPage) PageLines() int

func (*BaseListPage) PreviousLine

func (p *BaseListPage) PreviousLine(n int)

func (*BaseListPage) PreviousPage

func (p *BaseListPage) PreviousPage()

func (*BaseListPage) PreviousPara

func (p *BaseListPage) PreviousPara()

func (*BaseListPage) Refresh

func (p *BaseListPage) Refresh()

func (*BaseListPage) SetSearch

func (p *BaseListPage) SetSearch(searchCommand string)

func (*BaseListPage) TopOfPage

func (p *BaseListPage) TopOfPage()

func (*BaseListPage) Update

func (p *BaseListPage) Update()

type CommandBar

type CommandBar struct {
	EditBox
	// contains filtered or unexported fields
}

func (*CommandBar) Create

func (p *CommandBar) Create()

func (*CommandBar) NextCommand

func (p *CommandBar) NextCommand()

func (*CommandBar) PreviousCommand

func (p *CommandBar) PreviousCommand()

func (*CommandBar) Reset

func (p *CommandBar) Reset()

func (*CommandBar) Submit

func (p *CommandBar) Submit()

func (*CommandBar) Update

func (p *CommandBar) Update()

type CommandBarFragment

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

func (*CommandBarFragment) CommandBar

func (p *CommandBarFragment) CommandBar() *CommandBar

func (*CommandBarFragment) CommandMode

func (p *CommandBarFragment) CommandMode() bool

func (*CommandBarFragment) ExecuteCommand

func (p *CommandBarFragment) ExecuteCommand()

func (*CommandBarFragment) SetCommandMode

func (p *CommandBarFragment) SetCommandMode(mode bool)

type CommandBoxer

type CommandBoxer interface {
	SetCommandMode(bool)
	ExecuteCommand()
	CommandMode() bool
	CommandBar() *CommandBar
	Update()
}

type EditBox

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

func (*EditBox) DeleteRuneBackward

func (eb *EditBox) DeleteRuneBackward()

func (*EditBox) InsertRune

func (eb *EditBox) InsertRune(r rune)

func (*EditBox) MoveCursorOneRuneBackward

func (eb *EditBox) MoveCursorOneRuneBackward()

func (*EditBox) MoveCursorOneRuneForward

func (eb *EditBox) MoveCursorOneRuneForward()

func (*EditBox) MoveCursorTo

func (eb *EditBox) MoveCursorTo(boffset int)

func (*EditBox) MoveCursorToEnd

func (eb *EditBox) MoveCursorToEnd()

func (*EditBox) RuneBeforeCursor

func (eb *EditBox) RuneBeforeCursor() (rune, int)

func (*EditBox) RuneUnderCursor

func (eb *EditBox) RuneUnderCursor() (rune, int)

type EditPager

type EditPager interface {
	DeleteRuneBackward()
	InsertRune(r rune)
	Update()
	Create()
}

type GoBacker

type GoBacker interface {
	GoBack()
}

type HelpPage

func (*HelpPage) Create

func (p *HelpPage) Create()

func (*HelpPage) GoBack

func (p *HelpPage) GoBack()

func (*HelpPage) Refresh

func (p *HelpPage) Refresh()

func (*HelpPage) Search

func (p *HelpPage) Search()

func (*HelpPage) Update

func (p *HelpPage) Update()

type ItemSelecter

type ItemSelecter interface {
	SelectItem()
}

type LabelListPage

type LabelListPage struct {
	BaseListPage
	CommandBarFragment
	StatusBarFragment

	ActiveQuery Query
	// contains filtered or unexported fields
}

func (*LabelListPage) Create

func (p *LabelListPage) Create()

func (*LabelListPage) GoBack

func (p *LabelListPage) GoBack()

func (*LabelListPage) Search

func (p *LabelListPage) Search()

func (*LabelListPage) SelectItem

func (p *LabelListPage) SelectItem()

func (*LabelListPage) Update

func (p *LabelListPage) Update()
type Navigable interface {
	Create()
	Update()
	Id() string
}

type NextTicketer

type NextTicketer interface {
	NextTicket()
}

type PagePager

type PagePager interface {
	NextLine(int)
	PreviousLine(int)
	NextPara()
	PreviousPara()
	NextPage()
	PreviousPage()
	TopOfPage()
	BottomOfPage()
	IsPopulated() bool
	Update()
}

type PasswordInputBox

type PasswordInputBox struct {
	BaseInputBox
}

func (*PasswordInputBox) Create

func (p *PasswordInputBox) Create()

func (*PasswordInputBox) Update

func (p *PasswordInputBox) Update()

type PrevTicketer

type PrevTicketer interface {
	PrevTicket()
}

type Query

type Query struct {
	Name     string
	JQL      string
	Template string
}

type QueryPage

type QueryPage struct {
	BaseListPage
	CommandBarFragment
	StatusBarFragment
	// contains filtered or unexported fields
}

func (*QueryPage) Create

func (p *QueryPage) Create()

func (*QueryPage) IsPopulated

func (p *QueryPage) IsPopulated() bool

func (*QueryPage) NextPara

func (p *QueryPage) NextPara()

func (*QueryPage) PreviousPara

func (p *QueryPage) PreviousPara()

func (*QueryPage) Refresh

func (p *QueryPage) Refresh()

func (*QueryPage) Search

func (p *QueryPage) Search()

func (*QueryPage) SelectItem

func (p *QueryPage) SelectItem()

func (*QueryPage) SelectedQuery

func (p *QueryPage) SelectedQuery() Query

func (*QueryPage) Update

func (p *QueryPage) Update()

type Refresher

type Refresher interface {
	Refresh()
}

type ScrollableList

type ScrollableList struct {
	ui.Block

	// The items in the list
	Items []string

	// The window's offset relative to the start of `Items`
	Offset int

	// The foreground color for non-cursor items
	ItemFgColor ui.Attribute

	// The background color for non-cursor items
	ItemBgColor ui.Attribute

	// The foreground color for the cursor
	CursorFgColor ui.Attribute

	// The background color for the cursor
	CursorBgColor ui.Attribute

	// The position of the cursor relative to the start of `Items`
	Cursor int
}

A scrollable list with a cursor. To "deactivate" the cursor, just make the cursor colors the same as the item colors.

func NewScrollableList

func NewScrollableList() *ScrollableList

NewScrollableList returns a new *ScrollableList with current theme.

func (*ScrollableList) Add

func (sl *ScrollableList) Add(s string)

Add an element to the list

func (*ScrollableList) Buffer

func (sl *ScrollableList) Buffer() ui.Buffer

Implements the termui.Bufferer interface

func (*ScrollableList) CursorDown

func (sl *ScrollableList) CursorDown()

Move the cursor down one row; moving the cursor out of the window will cause scrolling.

func (*ScrollableList) CursorDownLines

func (sl *ScrollableList) CursorDownLines(n int)

func (*ScrollableList) CursorUp

func (sl *ScrollableList) CursorUp()

Move the cursor up one row; moving the cursor out of the window will cause scrolling.

func (*ScrollableList) CursorUpLines

func (sl *ScrollableList) CursorUpLines(n int)

func (*ScrollableList) PageDown

func (sl *ScrollableList) PageDown()

Move the window down one frame; this will move the cursor as well.

func (*ScrollableList) PageUp

func (sl *ScrollableList) PageUp()

Move the window up one frame; this will move the cursor as well.

func (*ScrollableList) ScrollDown

func (sl *ScrollableList) ScrollDown()

Move the window down one row

func (*ScrollableList) ScrollToBottom

func (sl *ScrollableList) ScrollToBottom()

Scroll to the bottom of the list

func (*ScrollableList) ScrollToTop

func (sl *ScrollableList) ScrollToTop()

Scroll to the top of the list

func (*ScrollableList) ScrollUp

func (sl *ScrollableList) ScrollUp()

Move the window up one row

func (*ScrollableList) SetCursorLine

func (sl *ScrollableList) SetCursorLine(n int)

func (*ScrollableList) SilentCursorDownLines

func (sl *ScrollableList) SilentCursorDownLines(n int)

func (*ScrollableList) SilentCursorUpLines

func (sl *ScrollableList) SilentCursorUpLines(n int)
type Search struct {
	// contains filtered or unexported fields
}

type Searcher

type Searcher interface {
	SetSearch(string)
	Search()
}

type Sort

type Sort struct {
	Name string
	JQL  string
}

type SortOrderPage

type SortOrderPage struct {
	BaseListPage
	// contains filtered or unexported fields
}

func (*SortOrderPage) Create

func (p *SortOrderPage) Create()

func (*SortOrderPage) IsPopulated

func (p *SortOrderPage) IsPopulated() bool

func (*SortOrderPage) NextPara

func (p *SortOrderPage) NextPara()

func (*SortOrderPage) PreviousPara

func (p *SortOrderPage) PreviousPara()

func (*SortOrderPage) Refresh

func (p *SortOrderPage) Refresh()

func (*SortOrderPage) SelectItem

func (p *SortOrderPage) SelectItem()

func (*SortOrderPage) SelectedSort

func (p *SortOrderPage) SelectedSort() Sort

func (*SortOrderPage) Update

func (p *SortOrderPage) Update()

type StatusBar

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

func (*StatusBar) Create

func (p *StatusBar) Create()

func (*StatusBar) StatusLines

func (p *StatusBar) StatusLines() []string

func (*StatusBar) Update

func (p *StatusBar) Update()

type StatusBarFragment

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

type TicketCommander

type TicketCommander interface {
	ActiveTicketId() string
	Refresh()
}

type TicketCommenter

type TicketCommenter interface {
	CommentTicket()
}

type TicketEditer

type TicketEditer interface {
	EditTicket()
}

type TicketListPage

type TicketListPage struct {
	BaseListPage
	CommandBarFragment
	StatusBarFragment
	ActiveQuery Query
	ActiveSort  Sort
}

func (*TicketListPage) ActiveTicketId

func (p *TicketListPage) ActiveTicketId() string

func (*TicketListPage) Create

func (p *TicketListPage) Create()

func (*TicketListPage) EditTicket

func (p *TicketListPage) EditTicket()

func (*TicketListPage) GetSelectedTicketId

func (p *TicketListPage) GetSelectedTicketId() string

func (*TicketListPage) GoBack

func (p *TicketListPage) GoBack()

func (*TicketListPage) Refresh

func (p *TicketListPage) Refresh()

func (*TicketListPage) Search

func (p *TicketListPage) Search()

func (*TicketListPage) SelectItem

func (p *TicketListPage) SelectItem()

func (*TicketListPage) Update

func (p *TicketListPage) Update()

type TicketShowPage

type TicketShowPage struct {
	BaseListPage
	CommandBarFragment
	StatusBarFragment
	MaxWrapWidth uint
	TicketId     string
	Template     string

	TicketTrail []*TicketShowPage // previously viewed tickets in drill-down
	WrapWidth   uint
	// contains filtered or unexported fields
}

func (*TicketShowPage) ActiveTicketId

func (p *TicketShowPage) ActiveTicketId() string

func (*TicketShowPage) Create

func (p *TicketShowPage) Create()

func (*TicketShowPage) EditTicket

func (p *TicketShowPage) EditTicket()

func (*TicketShowPage) GoBack

func (p *TicketShowPage) GoBack()

func (*TicketShowPage) Id

func (p *TicketShowPage) Id() string

func (*TicketShowPage) NextPara

func (p *TicketShowPage) NextPara()

func (*TicketShowPage) NextTicket

func (p *TicketShowPage) NextTicket()

func (*TicketShowPage) PrevTicket

func (p *TicketShowPage) PrevTicket()

func (*TicketShowPage) PreviousPara

func (p *TicketShowPage) PreviousPara()

func (*TicketShowPage) Refresh

func (p *TicketShowPage) Refresh()

func (*TicketShowPage) Search

func (p *TicketShowPage) Search()

func (*TicketShowPage) SelectItem

func (p *TicketShowPage) SelectItem()

func (*TicketShowPage) Update

func (p *TicketShowPage) Update()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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