Compare commits

...

28 Commits

Author SHA1 Message Date
Cory Bennett 172793ea69 version bump 2017-09-26 22:50:54 -07:00
Cory Bennett dc504de271 Updated Changelog 2017-09-26 22:50:54 -07:00
Cory Bennett 986cc78ed5 [#115] fix transition template for description 2017-09-26 22:49:40 -07:00
Cory Bennett 3913726991 update edit command to set queryFields on search to match what is used in template 2017-09-19 00:27:11 -07:00
Cory Bennett 0ba8aa035b fix edit with query loop, allow continuation when not submitting previous issue 2017-09-18 14:45:21 -07:00
Cory Bennett 098eb99ed6 fix edit when priority is not set 2017-09-18 14:45:04 -07:00
Cory Bennett 2ddaed2c29 flatten CommandRegistry list to make it more readable 2017-09-18 14:44:36 -07:00
Cory Bennett 9a62d1a553 tweak format 2017-09-18 00:53:57 -07:00
Cory Bennett 74d7287589 fix formatting 2017-09-18 00:50:49 -07:00
Cory Bennett c6e4b3dc0e add TOC 2017-09-18 00:49:34 -07:00
Cory Bennett 8b5e7b7568 fix usage 2017-09-18 00:47:35 -07:00
Cory Bennett 4dea068113 version bump 2017-09-18 00:44:55 -07:00
Cory Bennett 28e4554fe3 Updated Changelog 2017-09-18 00:44:55 -07:00
Cory Bennett 065f9c8d77 Updated Usage 2017-09-18 00:44:55 -07:00
Cory Bennett 9f433acaa0 clean up usage formatting, print aliases 2017-09-18 00:44:08 -07:00
Cory Bennett e4c10be811 add jira edit tests 2017-09-17 20:33:40 -07:00
Cory Bennett 4c6b36c83a fix edit 2017-09-17 20:32:50 -07:00
Cory Bennett a8eaa97de1 fix named query template expansion 2017-09-17 20:31:14 -07:00
Cory Bennett cd3cfd820f fix usage message 2017-09-17 20:30:44 -07:00
Cory Bennett a04c3a4c61 add test using named query 2017-09-17 18:11:57 -07:00
Cory Bennett bb66e58dfd use svg rather than png for godoc badge 2017-09-17 16:36:22 -07:00
Cory Bennett e21f18e987 Updated Changelog 2017-09-17 16:30:41 -07:00
Cory Bennett 96bbbd7ce3 fix table tests for issuetype addition 2017-09-17 16:15:28 -07:00
Cory Bennett 3e8b9bd9f5 need issuetype to use the default list table template now 2017-09-17 16:15:00 -07:00
Cory Bennett 8fe0d98d54 version bump 2017-09-17 15:53:46 -07:00
Cory Bennett 1a3eaf340c Updated Changelog 2017-09-17 15:53:46 -07:00
Cory Bennett 96b4658dcb fix logic for detecting changes in README.md 2017-09-17 15:53:30 -07:00
Cory Bennett c9d8dfbe55 [#102] add issuetype into the default queryfields and add it to the default table list template 2017-09-17 15:49:05 -07:00
15 changed files with 392 additions and 729 deletions
+20
View File
@@ -1,5 +1,25 @@
# Changelog
## 1.0.11 - 2017-09-26
* [[#115](https://github.com/Netflix-Skunkworks/go-jira/issues/115)] fix transition template for description [Cory Bennett] [[986cc78](https://github.com/Netflix-Skunkworks/go-jira/commit/986cc78)]
* update edit command to set queryFields on search to match what is used in template [Cory Bennett] [[3913726](https://github.com/Netflix-Skunkworks/go-jira/commit/3913726)]
* fix edit with query loop, allow continuation when not submitting previous issue [Cory Bennett] [[0ba8aa0](https://github.com/Netflix-Skunkworks/go-jira/commit/0ba8aa0)]
* fix edit when priority is not set [Cory Bennett] [[098eb99](https://github.com/Netflix-Skunkworks/go-jira/commit/098eb99)]
* flatten CommandRegistry list to make it more readable [Cory Bennett] [[2ddaed2](https://github.com/Netflix-Skunkworks/go-jira/commit/2ddaed2)]
## 1.0.10 - 2017-09-18
* clean up usage formatting, print aliases [Cory Bennett] [[9f433ac](https://github.com/Netflix-Skunkworks/go-jira/commit/9f433ac)]
* fix edit [Cory Bennett] [[4c6b36c](https://github.com/Netflix-Skunkworks/go-jira/commit/4c6b36c)]
* fix named query template expansion [Cory Bennett] [[a8eaa97](https://github.com/Netflix-Skunkworks/go-jira/commit/a8eaa97)]
* fix usage message [Cory Bennett] [[cd3cfd8](https://github.com/Netflix-Skunkworks/go-jira/commit/cd3cfd8)]
## 1.0.9 - 2017-09-17
* need issuetype to use the default list table template now [Cory Bennett] [[3e8b9bd](https://github.com/Netflix-Skunkworks/go-jira/commit/3e8b9bd)]
* [[#102](https://github.com/Netflix-Skunkworks/go-jira/issues/102)] add issuetype into the default queryfields and add it to the default `table` list template [Cory Bennett] [[c9d8dfb](https://github.com/Netflix-Skunkworks/go-jira/commit/c9d8dfb)]
## 1.0.8 - 2017-09-17
* [[#100](https://github.com/Netflix-Skunkworks/go-jira/issues/100)] add support for posting, fetching, listing and removing attachments [Cory Bennett] [[66eb7bf](https://github.com/Netflix-Skunkworks/go-jira/commit/66eb7bf)]
+3 -3
View File
@@ -41,7 +41,7 @@ all:
go get -u github.com/karalabe/xgo
rm -rf dist
mkdir -p dist
xgo --targets="freebsd/amd64,linux/386,linux/amd64,windows/386,windows/amd64,darwin/amd64" -dest ./dist -ldflags="-w -s" ./cmd/jira
xgo --go 1.9.0 --targets="freebsd/amd64,linux/386,linux/amd64,windows/386,windows/amd64,darwin/amd64" -dest ./dist -ldflags="-w -s" ./cmd/jira
install:
${MAKE} GOBIN=$$HOME/bin build
@@ -68,9 +68,9 @@ update-changelog:
release:
perl -pi -e 'undef $$/; s/\n```\nusage.*```//sg' README.md
echo '```' >> README.md
./jira --help-long >> README.md || true
./jira --help >> README.md 2>&1 || true
echo '```' >> README.md
git diff --shortstat README.md | grep -v . || git commit -m "Updated Usage" README.md
git diff --exit-code --quiet README.md || git commit -m "Updated Usage" README.md
git commit -m "Updated Changelog" CHANGELOG.md
git commit -m "version bump" jira.go
git tag v$(NEWVER)
+86 -432
View File
@@ -1,8 +1,36 @@
[![Join the chat at https://gitter.im/go-jira-cli/help](https://badges.gitter.im/go-jira-cli/help.svg)](https://gitter.im/go-jira-cli/help?utm_source=badge&utm_medium=badge&utm_content=badge)
[![Build Status](https://travis-ci.org/Netflix-Skunkworks/go-jira.svg?branch=master)](https://travis-ci.org/Netflix-Skunkworks/go-jira)
[![GoDoc](https://godoc.org/gopkg.in/Netflix-Skunkworks/go-jira.v1?status.png)](https://godoc.org/gopkg.in/Netflix-Skunkworks/go-jira.v1)
[![GoDoc](https://godoc.org/gopkg.in/Netflix-Skunkworks/go-jira.v1?status.svg)](https://godoc.org/gopkg.in/Netflix-Skunkworks/go-jira.v1)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
### Table of Contents
* [Summary](#go-jira)
* [Install](#install)
* [Download](#download)
* [Build](#build)
* [v1 vs v0 changes](#v1-vs-v0-changes)
* [<strong>Golang library import</strong>](#golang-library-import)
* [<strong>Configs per command</strong>](#configs-per-command)
* [<strong>Custom Commands</strong>](#custom-commands)
* [<strong>Incompatible command changes</strong>](#incompatible-command-changes)
* [<strong>Login process change</strong>](#login-process-change)
* [Configuration](#configuration)
* [Dynamic Configuration](#dynamic-configuration)
* [Custom Commands](#custom-commands-1)
* [Commands](#commands)
* [Options](#options)
* [Arguments](#arguments)
* [Script Template](#script-template)
* [Examples](#examples)
* [Editing](#editing)
* [Templates](#templates)
* [Writing/Editing Templates](#writingediting-templates)
* [Authentication](#authentication)
* [keyring password source](#keyring-password-source)
* [pass password source](#pass-password-source)
* [Usage](#usage)
# go-jira
simple command line client for Atlassian's Jira service written in Go
@@ -399,7 +427,7 @@ usage: jira [<flags>] <command> [<args> ...]
Jira Command Line Interface
Flags:
Global flags:
--help Show context-sensitive help (also try --help-long and --help-man).
-v, --verbose ... Increase verbosity for debugging
-e, --endpoint=ENDPOINT Base URI to use for Jira
@@ -409,435 +437,61 @@ Flags:
-u, --user=USER Login name used for authentication with Jira service
Commands:
help [<command>...]
Show help.
version
Prints version
login
Attempt to login into jira server
logout
Deactivate sesssion with Jira server
list [<flags>]
Prints list of issues for given search criteria
-t, --template=TEMPLATE Template to use for output
--gjq=GJQ GJSON Query to filter output, see https://goo.gl/iaYwJ5
-a, --assignee=ASSIGNEE User assigned the issue
-c, --component=COMPONENT Component to search for
-i, --issuetype=ISSUETYPE Issue type to search for
-l, --limit=LIMIT Maximum number of results to return in search
-p, --project=PROJECT Project to search for
-n, --named-query=NAMED-QUERY The name of a query in the `queries` configuration
-q, --query=QUERY Jira Query Language (JQL) expression for the search
-f, --queryfields=QUERYFIELDS Fields that are used in "list" template
-r, --reporter=REPORTER Reporter to search for
-S, --status=STATUS Filter on issue status
-s, --sort=SORT Sort order to return
-w, --watcher=WATCHER Watcher to search for
view [<flags>] <ISSUE>
Prints issue details
-b, --browse Open issue(s) in browser after operation
-t, --template=TEMPLATE Template to use for output
--gjq=GJQ GJSON Query to filter output, see https://goo.gl/iaYwJ5
--expand=EXPAND ... field to expand for the issue
--field=FIELD ... field to return for the issue
--property=PROPERTY ... property to return for issue
create [<flags>]
Create issue
-b, --browse Open issue(s) in browser after operation
--editor=EDITOR Editor to use
-t, --template=TEMPLATE Template to use for output
--noedit Disable opening the editor
-p, --project=PROJECT project to create issue in
-i, --issuetype=ISSUETYPE issuetype in to create
-m, --comment=COMMENT Comment message for issue
-o, --override=OVERRIDE ... Set issue property
--saveFile=SAVEFILE Write issue as yaml to file
edit [<flags>] [<ISSUE>]
Edit issue details
-b, --browse Open issue(s) in browser after operation
--editor=EDITOR Editor to use
-t, --template=TEMPLATE Template to use for output
--noedit Disable opening the editor
-n, --named-query=NAMED-QUERY The name of a query in the `queries` configuration
-q, --query=QUERY Jira Query Language (JQL) expression for the search to edit multiple issues
-m, --comment=COMMENT Comment message for issue
-o, --override=OVERRIDE ... Set issue property
comment [<flags>] [<ISSUE>]
Add comment to issue
-b, --browse Open issue(s) in browser after operation
--editor=EDITOR Editor to use
-t, --template=TEMPLATE Template to use for output
--noedit Disable opening the editor
-m, --comment=COMMENT Comment message for issue
epic create [<flags>]
Create Epic
-b, --browse Open issue(s) in browser after operation
--editor=EDITOR Editor to use
-t, --template=TEMPLATE Template to use for output
--noedit Disable opening the editor
-p, --project=PROJECT project to create epic in
-n, --epic-name=EPIC-NAME Epic Name
-m, --comment=COMMENT Comment message for epic
-o, --override=OVERRIDE ... Set epic property
--saveFile=SAVEFILE Write epic as yaml to file
epic list [<flags>] <EPIC>
Prints list of issues for an epic with optional search criteria
-t, --template=TEMPLATE Template to use for output
--gjq=GJQ GJSON Query to filter output, see https://goo.gl/iaYwJ5
-a, --assignee=ASSIGNEE User assigned the issue
-c, --component=COMPONENT Component to search for
-i, --issuetype=ISSUETYPE Issue type to search for
-l, --limit=LIMIT Maximum number of results to return in search
-p, --project=PROJECT Project to search for
-n, --named-query=NAMED-QUERY The name of a query in the `queries` configuration
-q, --query=QUERY Jira Query Language (JQL) expression for the search
-f, --queryfields=QUERYFIELDS Fields that are used in "list" template
-r, --reporter=REPORTER Reporter to search for
-S, --status=STATUS Filter on issue status
-s, --sort=SORT Sort order to return
-w, --watcher=WATCHER Watcher to search for
epic add <EPIC> <ISSUE>...
Add issues to Epic
epic remove <ISSUE>...
Remove issues from Epic
worklog list [<flags>] <ISSUE>
Prints the worklog data for given issue
-b, --browse Open issue(s) in browser after operation
-t, --template=TEMPLATE Template to use for output
--gjq=GJQ GJSON Query to filter output, see https://goo.gl/iaYwJ5
worklog add [<flags>] <ISSUE>
Add a worklog to an issue
-b, --browse Open issue(s) in browser after operation
--editor=EDITOR Editor to use
-t, --template=TEMPLATE Template to use for output
--noedit Disable opening the editor
-m, --comment=COMMENT Comment message for worklog
-T, --time-spent=TIME-SPENT Time spent working on issue
-S, --started=STARTED Time you started work
fields [<flags>]
Prints all fields, both System and Custom
-t, --template=TEMPLATE Template to use for output
--gjq=GJQ GJSON Query to filter output, see https://goo.gl/iaYwJ5
createmeta [<flags>]
View 'create' metadata
-t, --template=TEMPLATE Template to use for output
--gjq=GJQ GJSON Query to filter output, see https://goo.gl/iaYwJ5
-p, --project=PROJECT project to fetch create metadata
-i, --issuetype=ISSUETYPE issuetype in project to fetch create metadata
editmeta [<flags>] <ISSUE>
View 'edit' metadata
-b, --browse Open issue(s) in browser after operation
-t, --template=TEMPLATE Template to use for output
--gjq=GJQ GJSON Query to filter output, see https://goo.gl/iaYwJ5
subtask [<flags>] [<ISSUE>]
Subtask issue
-b, --browse Open issue(s) in browser after operation
--editor=EDITOR Editor to use
-t, --template=TEMPLATE Template to use for output
--noedit Disable opening the editor
-p, --project=PROJECT project to subtask issue in
-m, --comment=COMMENT Comment message for issue
-o, --override=OVERRIDE ... Set issue property
dup [<flags>] <DUPLICATE> <ISSUE>
Mark issues as duplicate
-b, --browse Open issue(s) in browser after operation
--editor=EDITOR Editor to use
-t, --template=TEMPLATE Template to use for output
-m, --comment=COMMENT Comment message when marking issue as duplicate
block [<flags>] <BLOCKER> <ISSUE>
Mark issues as blocker
-b, --browse Open issue(s) in browser after operation
--editor=EDITOR Editor to use
-t, --template=TEMPLATE Template to use for output
-m, --comment=COMMENT Comment message when marking issue as blocker
issuelink [<flags>] <OUTWARDISSUE> <ISSUELINKTYPE> <INWARDISSUE>
Link two issues
-b, --browse Open issue(s) in browser after operation
--editor=EDITOR Editor to use
-t, --template=TEMPLATE Template to use for output
-m, --comment=COMMENT Comment message when linking issue
issuelinktypes [<flags>]
Show the issue link types
-t, --template=TEMPLATE Template to use for output
--gjq=GJQ GJSON Query to filter output, see https://goo.gl/iaYwJ5
transition [<flags>] <TRANSITION> <ISSUE>
Transition issue to given state
-b, --browse Open issue(s) in browser after operation
-t, --template=TEMPLATE Template to use for output
--noedit Disable opening the editor
-m, --comment=COMMENT Comment message for issue
-o, --override=OVERRIDE ... Set issue property
transitions [<flags>] <ISSUE>
List valid issue transitions
-b, --browse Open issue(s) in browser after operation
-t, --template=TEMPLATE Template to use for output
--gjq=GJQ GJSON Query to filter output, see https://goo.gl/iaYwJ5
transmeta [<flags>] <ISSUE>
List valid issue transitions
-b, --browse Open issue(s) in browser after operation
-t, --template=TEMPLATE Template to use for output
--gjq=GJQ GJSON Query to filter output, see https://goo.gl/iaYwJ5
close [<flags>] <ISSUE>
Transition issue to close state
-b, --browse Open issue(s) in browser after operation
-t, --template=TEMPLATE Template to use for output
--noedit Disable opening the editor
-m, --comment=COMMENT Comment message for issue
-o, --override=OVERRIDE ... Set issue property
acknowledge [<flags>] <ISSUE>
Transition issue to acknowledge state
-b, --browse Open issue(s) in browser after operation
-t, --template=TEMPLATE Template to use for output
--noedit Disable opening the editor
-m, --comment=COMMENT Comment message for issue
-o, --override=OVERRIDE ... Set issue property
reopen [<flags>] <ISSUE>
Transition issue to reopen state
-b, --browse Open issue(s) in browser after operation
-t, --template=TEMPLATE Template to use for output
--noedit Disable opening the editor
-m, --comment=COMMENT Comment message for issue
-o, --override=OVERRIDE ... Set issue property
resolve [<flags>] <ISSUE>
Transition issue to resolve state
-b, --browse Open issue(s) in browser after operation
-t, --template=TEMPLATE Template to use for output
--noedit Disable opening the editor
-m, --comment=COMMENT Comment message for issue
-o, --override=OVERRIDE ... Set issue property
start [<flags>] <ISSUE>
Transition issue to start state
-b, --browse Open issue(s) in browser after operation
-t, --template=TEMPLATE Template to use for output
--noedit Disable opening the editor
-m, --comment=COMMENT Comment message for issue
-o, --override=OVERRIDE ... Set issue property
stop [<flags>] <ISSUE>
Transition issue to stop state
-b, --browse Open issue(s) in browser after operation
-t, --template=TEMPLATE Template to use for output
--noedit Disable opening the editor
-m, --comment=COMMENT Comment message for issue
-o, --override=OVERRIDE ... Set issue property
todo [<flags>] <ISSUE>
Transition issue to To Do state
-b, --browse Open issue(s) in browser after operation
-t, --template=TEMPLATE Template to use for output
--noedit Disable opening the editor
-m, --comment=COMMENT Comment message for issue
-o, --override=OVERRIDE ... Set issue property
backlog [<flags>] <ISSUE>
Transition issue to Backlog state
-b, --browse Open issue(s) in browser after operation
-t, --template=TEMPLATE Template to use for output
--noedit Disable opening the editor
-m, --comment=COMMENT Comment message for issue
-o, --override=OVERRIDE ... Set issue property
done [<flags>] <ISSUE>
Transition issue to Done state
-b, --browse Open issue(s) in browser after operation
-t, --template=TEMPLATE Template to use for output
--noedit Disable opening the editor
-m, --comment=COMMENT Comment message for issue
-o, --override=OVERRIDE ... Set issue property
in-progress [<flags>] <ISSUE>
Transition issue to Progress state
-b, --browse Open issue(s) in browser after operation
-t, --template=TEMPLATE Template to use for output
--noedit Disable opening the editor
-m, --comment=COMMENT Comment message for issue
-o, --override=OVERRIDE ... Set issue property
vote [<flags>] [<ISSUE>]
Vote up/down an issue
-b, --browse Open issue(s) in browser after operation
-d, --down downvote the issue
rank [<flags>] <FIRST-ISSUE> <after|before> <SECOND-ISSUE>
Mark issues as blocker
-b, --browse Open issue(s) in browser after operation
watch [<flags>] <ISSUE> [<WATCHER>]
Add/Remove watcher to issue
-b, --browse Open issue(s) in browser after operation
-r, --remove remove watcher from issue
labels add [<flags>] <ISSUE> <LABEL>...
Add labels to an issue
-b, --browse Open issue(s) in browser after operation
labels set [<flags>] <ISSUE> <LABEL>...
Set labels on an issue
-b, --browse Open issue(s) in browser after operation
labels remove [<flags>] <ISSUE> <LABEL>...
Remove labels from an issue
-b, --browse Open issue(s) in browser after operation
take [<flags>] <ISSUE> [<ASSIGNEE>]
Assign issue to yourself
-b, --browse Open issue(s) in browser after operation
--default use default user for assignee
assign [<flags>] <ISSUE> [<ASSIGNEE>]
Assign user to issue
-b, --browse Open issue(s) in browser after operation
--default use default user for assignee
unassign [<flags>] <ISSUE> [<ASSIGNEE>]
Unassign an issue
-b, --browse Open issue(s) in browser after operation
--default use default user for assignee
component add [<flags>]
Add component
--editor=EDITOR Editor to use
-t, --template=TEMPLATE Template to use for output
--noedit Disable opening the editor
-p, --project=PROJECT project to create component in
-n, --name=NAME name of component
-d, --description=DESCRIPTION description of component
-l, --lead=LEAD person that acts as lead for component
components [<flags>]
Show components for a project
-t, --template=TEMPLATE Template to use for output
--gjq=GJQ GJSON Query to filter output, see https://goo.gl/iaYwJ5
-p, --project=PROJECT project to list components
issuetypes [<flags>]
Show issue types for a project
-t, --template=TEMPLATE Template to use for output
--gjq=GJQ GJSON Query to filter output, see https://goo.gl/iaYwJ5
-p, --project=PROJECT project to list issueTypes
attach create [<flags>] <ISSUE> [<ATTACHMENT>]
Attach file to issue
-b, --browse Open issue(s) in browser after operation
--saveFile=SAVEFILE Write attachment information as yaml to file
-f, --filename=FILENAME Filename to use for attachment
attach list [<flags>] <ISSUE>
Prints issue details
-b, --browse Open issue(s) in browser after operation
-t, --template=TEMPLATE Template to use for output
attach get [<flags>] [<ATTACHMENT-ID>]
Fetch attachment
-o, --output=OUTPUT Write attachment to specified file name, '-' for stdout
attach remove [<ATTACHMENT-ID>]
Delete attachment
export-templates [<flags>]
Export templates for customizations
-t, --template=TEMPLATE Template to export
-d, --dir=DIR directory to write tempates to
unexport-templates [<flags>]
Remove unmodified exported templates
-t, --template=TEMPLATE Template to export
-d, --dir=DIR directory to write tempates to
browse <ISSUE>
Open issue in browser
request [<flags>] <API> [<JSON>]
Open issue in requestr
-t, --template=TEMPLATE Template to use for output
--gjq=GJQ GJSON Query to filter output, see https://goo.gl/iaYwJ5
-M, --method=METHOD HTTP request method to use
help: Show help.
version: Prints version
acknowledge: Transition issue to acknowledge state
assign: Assign user to issue
attach create: Attach file to issue
attach get: Fetch attachment
attach list: Prints attachment details for issue
attach remove: Delete attachment
backlog: Transition issue to Backlog state
block: Mark issues as blocker
browse: Open issue in browser
close: Transition issue to close state
comment: Add comment to issue
component add: Add component
components: Show components for a project
create: Create issue
createmeta: View 'create' metadata
done: Transition issue to Done state
dup: Mark issues as duplicate
edit: Edit issue details
editmeta: View 'edit' metadata
epic add: Add issues to Epic
epic create: Create Epic
epic list: Prints list of issues for an epic with optional search criteria
epic remove: Remove issues from Epic
export-templates: Export templates for customizations
fields: Prints all fields, both System and Custom
in-progress: Transition issue to Progress state
issuelink: Link two issues
issuelinktypes: Show the issue link types
issuetypes: Show issue types for a project
labels add: Add labels to an issue
labels remove: Remove labels from an issue
labels set: Set labels on an issue
list: Prints list of issues for given search criteria
login: Attempt to login into jira server
logout: Deactivate sesssion with Jira server
rank: Mark issues as blocker
reopen: Transition issue to reopen state
request: Open issue in requestr
resolve: Transition issue to resolve state
start: Transition issue to start state
stop: Transition issue to stop state
subtask: Subtask issue
take: Assign issue to yourself
todo: Transition issue to To Do state
transition: Transition issue to given state
transitions: List valid issue transitions
transmeta: List valid issue transitions
unassign: Unassign an issue
unexport-templates: Remove unmodified exported templates
view: Prints issue details
vote: Vote up/down an issue
watch: Add/Remove watcher to issue
worklog add: Add a worklog to an issue
worklog list: Prints the worklog data for given issue
```
+141 -229
View File
@@ -52,6 +52,92 @@ func increaseLogLevel(verbosity int) {
}
}
var usage = `{{define "FormatCommand"}}\
{{if .FlagSummary}} {{.FlagSummary}}{{end}}\
{{range .Args}} {{if not .Required}}[{{end}}<{{.Name}}>{{if .Value|IsCumulative}}...{{end}}{{if not .Required}}]{{end}}{{end}}\
{{end}}\
{{define "FormatBriefCommands"}}\
{{range .FlattenedCommands}}\
{{if not .Hidden}}\
{{ print .FullCommand ":" | printf "%-20s"}} {{.Help}}
{{end}}\
{{end}}\
{{end}}\
{{define "FormatCommands"}}\
{{range .FlattenedCommands}}\
{{if not .Hidden}}\
{{.FullCommand}}{{if .Default}}*{{end}}{{template "FormatCommand" .}}
{{.Help|Wrap 4}}
{{with .Flags|FlagsToTwoColumns}}{{FormatTwoColumnsWithIndent . 4 2}}{{end}}
{{end}}\
{{end}}\
{{end}}\
{{define "FormatUsage"}}\
{{template "FormatCommand" .}}{{if .Commands}} <command> [<args> ...]{{end}}
{{if .Help}}
{{.Help|Wrap 0}}\
{{end}}\
{{end}}\
{{if .Context.SelectedCommand}}\
usage: {{.App.Name}} {{.Context.SelectedCommand}}{{template "FormatCommand" .Context.SelectedCommand}}
{{if .Context.SelectedCommand.Aliases }}\
{{range $top := .App.Commands}}\
{{if eq $top.FullCommand $.Context.SelectedCommand.FullCommand}}\
{{range $alias := $.Context.SelectedCommand.Aliases}}\
alias: {{$.App.Name}} {{$alias}}{{template "FormatCommand" $.Context.SelectedCommand}}
{{end}}\
{{else}}\
{{range $sub := $top.Commands}}\
{{if eq $sub.FullCommand $.Context.SelectedCommand.FullCommand}}\
{{range $alias := $.Context.SelectedCommand.Aliases}}\
alias: {{$.App.Name}} {{$top.Name}} {{$alias}}{{template "FormatCommand" $.Context.SelectedCommand}}
{{end}}\
{{end}}\
{{end}}\
{{end}}\
{{end}}\
{{end}}
{{if .Context.SelectedCommand.Help}}\
{{.Context.SelectedCommand.Help|Wrap 0}}
{{end}}\
{{else}}\
usage: {{.App.Name}}{{template "FormatUsage" .App}}
{{end}}\
{{if .App.Flags}}\
Global flags:
{{.App.Flags|FlagsToTwoColumns|FormatTwoColumns}}
{{end}}\
{{if .Context.SelectedCommand}}\
{{if and .Context.SelectedCommand.Flags|RequiredFlags}}\
Required flags:
{{.Context.SelectedCommand.Flags|RequiredFlags|FlagsToTwoColumns|FormatTwoColumns}}
{{end}}\
{{if .Context.SelectedCommand.Flags|OptionalFlags}}\
Optional flags:
{{.Context.SelectedCommand.Flags|OptionalFlags|FlagsToTwoColumns|FormatTwoColumns}}
{{end}}\
{{end}}\
{{if .Context.Args}}\
Args:
{{.Context.Args|ArgsToTwoColumns|FormatTwoColumns}}
{{end}}\
{{if .Context.SelectedCommand}}\
{{if .Context.SelectedCommand.Commands}}\
Subcommands:
{{template "FormatCommands" .Context.SelectedCommand}}
{{end}}\
{{else if .App.Commands}}\
Commands:
{{template "FormatBriefCommands" .App}}
{{end}}\
`
func main() {
defer handleExit()
logBackend := logging.NewLogBackend(os.Stderr, "", 0)
@@ -76,6 +162,7 @@ func main() {
fmt.Println(jira.VERSION)
panic(jiracli.Exit{Code: 0})
})
app.UsageTemplate(usage)
var verbosity int
app.Flag("verbose", "Increase verbosity for debugging").Short('v').PreAction(func(_ *kingpin.ParseContext) error {
@@ -102,235 +189,60 @@ func main() {
o := oreo.New().WithCookieFile(filepath.Join(jiracli.Homedir(), fig.ConfigDir, "cookies.js"))
registry := []jiracli.CommandRegistry{
jiracli.CommandRegistry{
Command: "login",
Entry: jiracmd.CmdLoginRegistry(),
},
jiracli.CommandRegistry{
Command: "logout",
Entry: jiracmd.CmdLogoutRegistry(),
},
jiracli.CommandRegistry{
Command: "list",
Aliases: []string{"ls"},
Entry: jiracmd.CmdListRegistry(),
},
jiracli.CommandRegistry{
Command: "view",
Entry: jiracmd.CmdViewRegistry(),
},
jiracli.CommandRegistry{
Command: "create",
Entry: jiracmd.CmdCreateRegistry(),
},
jiracli.CommandRegistry{
Command: "edit",
Entry: jiracmd.CmdEditRegistry(),
},
jiracli.CommandRegistry{
Command: "comment",
Entry: jiracmd.CmdCommentRegistry(),
},
jiracli.CommandRegistry{
Command: "epic create",
Entry: jiracmd.CmdEpicCreateRegistry(),
},
jiracli.CommandRegistry{
Command: "epic list",
Entry: jiracmd.CmdEpicListRegistry(),
Aliases: []string{"ls"},
},
jiracli.CommandRegistry{
Command: "epic add",
Entry: jiracmd.CmdEpicAddRegistry(),
},
jiracli.CommandRegistry{
Command: "epic remove",
Entry: jiracmd.CmdEpicRemoveRegistry(),
Aliases: []string{"rm"},
},
jiracli.CommandRegistry{
Command: "worklog list",
Entry: jiracmd.CmdWorklogListRegistry(),
Default: true,
},
jiracli.CommandRegistry{
Command: "worklog add",
Entry: jiracmd.CmdWorklogAddRegistry(),
},
jiracli.CommandRegistry{
Command: "fields",
Entry: jiracmd.CmdFieldsRegistry(),
},
jiracli.CommandRegistry{
Command: "createmeta",
Entry: jiracmd.CmdCreateMetaRegistry(),
},
jiracli.CommandRegistry{
Command: "editmeta",
Entry: jiracmd.CmdEditMetaRegistry(),
},
jiracli.CommandRegistry{
Command: "subtask",
Entry: jiracmd.CmdSubtaskRegistry(),
},
jiracli.CommandRegistry{
Command: "dup",
Entry: jiracmd.CmdDupRegistry(),
},
jiracli.CommandRegistry{
Command: "block",
Entry: jiracmd.CmdBlockRegistry(),
},
jiracli.CommandRegistry{
Command: "issuelink",
Entry: jiracmd.CmdIssueLinkRegistry(),
},
jiracli.CommandRegistry{
Command: "issuelinktypes",
Entry: jiracmd.CmdIssueLinkTypesRegistry(),
},
jiracli.CommandRegistry{
Command: "transition",
Aliases: []string{"trans"},
Entry: jiracmd.CmdTransitionRegistry(""),
},
jiracli.CommandRegistry{
Command: "transitions",
Entry: jiracmd.CmdTransitionsRegistry("transitions"),
},
jiracli.CommandRegistry{
Command: "transmeta",
Entry: jiracmd.CmdTransitionsRegistry("debug"),
},
jiracli.CommandRegistry{
Command: "close",
Entry: jiracmd.CmdTransitionRegistry("close"),
},
jiracli.CommandRegistry{
Command: "acknowledge",
Aliases: []string{"ack"},
Entry: jiracmd.CmdTransitionRegistry("acknowledge"),
},
jiracli.CommandRegistry{
Command: "reopen",
Entry: jiracmd.CmdTransitionRegistry("reopen"),
},
jiracli.CommandRegistry{
Command: "resolve",
Entry: jiracmd.CmdTransitionRegistry("resolve"),
},
jiracli.CommandRegistry{
Command: "start",
Entry: jiracmd.CmdTransitionRegistry("start"),
},
jiracli.CommandRegistry{
Command: "stop",
Entry: jiracmd.CmdTransitionRegistry("stop"),
},
jiracli.CommandRegistry{
Command: "todo",
Entry: jiracmd.CmdTransitionRegistry("To Do"),
},
jiracli.CommandRegistry{
Command: "backlog",
Entry: jiracmd.CmdTransitionRegistry("Backlog"),
},
jiracli.CommandRegistry{
Command: "done",
Entry: jiracmd.CmdTransitionRegistry("Done"),
},
jiracli.CommandRegistry{
Command: "in-progress",
Aliases: []string{"prog", "progress"},
Entry: jiracmd.CmdTransitionRegistry("Progress"),
},
jiracli.CommandRegistry{
Command: "vote",
Entry: jiracmd.CmdVoteRegistry(),
},
jiracli.CommandRegistry{
Command: "rank",
Entry: jiracmd.CmdRankRegistry(),
},
jiracli.CommandRegistry{
Command: "watch",
Entry: jiracmd.CmdWatchRegistry(),
},
jiracli.CommandRegistry{
Command: "labels add",
Entry: jiracmd.CmdLabelsAddRegistry(),
},
jiracli.CommandRegistry{
Command: "labels set",
Entry: jiracmd.CmdLabelsSetRegistry(),
},
jiracli.CommandRegistry{
Command: "labels remove",
Entry: jiracmd.CmdLabelsRemoveRegistry(),
Aliases: []string{"rm"},
},
jiracli.CommandRegistry{
Command: "take",
Entry: jiracmd.CmdTakeRegistry(),
},
jiracli.CommandRegistry{
Command: "assign",
Entry: jiracmd.CmdAssignRegistry(),
Aliases: []string{"give"},
},
jiracli.CommandRegistry{
Command: "unassign",
Entry: jiracmd.CmdUnassignRegistry(),
},
jiracli.CommandRegistry{
Command: "component add",
Entry: jiracmd.CmdComponentAddRegistry(),
},
jiracli.CommandRegistry{
Command: "components",
Entry: jiracmd.CmdComponentsRegistry(),
},
jiracli.CommandRegistry{
Command: "issuetypes",
Entry: jiracmd.CmdIssueTypesRegistry(),
},
jiracli.CommandRegistry{
Command: "attach create",
Entry: jiracmd.CmdAttachCreateRegistry(),
},
jiracli.CommandRegistry{
Command: "attach list",
Entry: jiracmd.CmdAttachListRegistry(),
Aliases: []string{"ls"},
},
jiracli.CommandRegistry{
Command: "attach get",
Entry: jiracmd.CmdAttachGetRegistry(),
},
jiracli.CommandRegistry{
Command: "attach remove",
Entry: jiracmd.CmdAttachRemoveRegistry(),
Aliases: []string{"rm"},
},
jiracli.CommandRegistry{
Command: "export-templates",
Entry: jiracmd.CmdExportTemplatesRegistry(),
},
jiracli.CommandRegistry{
Command: "unexport-templates",
Entry: jiracmd.CmdUnexportTemplatesRegistry(),
},
jiracli.CommandRegistry{
Command: "browse",
Entry: jiracmd.CmdBrowseRegistry(),
Aliases: []string{"b"},
},
jiracli.CommandRegistry{
Command: "request",
Entry: jiracmd.CmdRequestRegistry(),
Aliases: []string{"req"},
},
{Command: "acknowledge", Entry: jiracmd.CmdTransitionRegistry("acknowledge"), Aliases: []string{"ack"}},
{Command: "assign", Entry: jiracmd.CmdAssignRegistry(), Aliases: []string{"give"}},
{Command: "attach create", Entry: jiracmd.CmdAttachCreateRegistry()},
{Command: "attach get", Entry: jiracmd.CmdAttachGetRegistry()},
{Command: "attach list", Entry: jiracmd.CmdAttachListRegistry(), Aliases: []string{"ls"}},
{Command: "attach remove", Entry: jiracmd.CmdAttachRemoveRegistry(), Aliases: []string{"rm"}},
{Command: "backlog", Entry: jiracmd.CmdTransitionRegistry("Backlog")},
{Command: "block", Entry: jiracmd.CmdBlockRegistry()},
{Command: "browse", Entry: jiracmd.CmdBrowseRegistry(), Aliases: []string{"b"}},
{Command: "close", Entry: jiracmd.CmdTransitionRegistry("close")},
{Command: "comment", Entry: jiracmd.CmdCommentRegistry()},
{Command: "component add", Entry: jiracmd.CmdComponentAddRegistry()},
{Command: "components", Entry: jiracmd.CmdComponentsRegistry()},
{Command: "create", Entry: jiracmd.CmdCreateRegistry()},
{Command: "createmeta", Entry: jiracmd.CmdCreateMetaRegistry()},
{Command: "done", Entry: jiracmd.CmdTransitionRegistry("Done")},
{Command: "dup", Entry: jiracmd.CmdDupRegistry()},
{Command: "edit", Entry: jiracmd.CmdEditRegistry()},
{Command: "editmeta", Entry: jiracmd.CmdEditMetaRegistry()},
{Command: "epic add", Entry: jiracmd.CmdEpicAddRegistry()},
{Command: "epic create", Entry: jiracmd.CmdEpicCreateRegistry()},
{Command: "epic list", Entry: jiracmd.CmdEpicListRegistry(), Aliases: []string{"ls"}},
{Command: "epic remove", Entry: jiracmd.CmdEpicRemoveRegistry(), Aliases: []string{"rm"}},
{Command: "export-templates", Entry: jiracmd.CmdExportTemplatesRegistry()},
{Command: "fields", Entry: jiracmd.CmdFieldsRegistry()},
{Command: "in-progress", Entry: jiracmd.CmdTransitionRegistry("Progress"), Aliases: []string{"prog", "progress"}},
{Command: "issuelink", Entry: jiracmd.CmdIssueLinkRegistry()},
{Command: "issuelinktypes", Entry: jiracmd.CmdIssueLinkTypesRegistry()},
{Command: "issuetypes", Entry: jiracmd.CmdIssueTypesRegistry()},
{Command: "labels add", Entry: jiracmd.CmdLabelsAddRegistry()},
{Command: "labels remove", Entry: jiracmd.CmdLabelsRemoveRegistry(), Aliases: []string{"rm"}},
{Command: "labels set", Entry: jiracmd.CmdLabelsSetRegistry()},
{Command: "list", Entry: jiracmd.CmdListRegistry(), Aliases: []string{"ls"}},
{Command: "login", Entry: jiracmd.CmdLoginRegistry()},
{Command: "logout", Entry: jiracmd.CmdLogoutRegistry()},
{Command: "rank", Entry: jiracmd.CmdRankRegistry()},
{Command: "reopen", Entry: jiracmd.CmdTransitionRegistry("reopen")},
{Command: "request", Entry: jiracmd.CmdRequestRegistry(), Aliases: []string{"req"}},
{Command: "resolve", Entry: jiracmd.CmdTransitionRegistry("resolve")},
{Command: "start", Entry: jiracmd.CmdTransitionRegistry("start")},
{Command: "stop", Entry: jiracmd.CmdTransitionRegistry("stop")},
{Command: "subtask", Entry: jiracmd.CmdSubtaskRegistry()},
{Command: "take", Entry: jiracmd.CmdTakeRegistry()},
{Command: "todo", Entry: jiracmd.CmdTransitionRegistry("To Do")},
{Command: "transition", Entry: jiracmd.CmdTransitionRegistry(""), Aliases: []string{"trans"}},
{Command: "transitions", Entry: jiracmd.CmdTransitionsRegistry("transitions")},
{Command: "transmeta", Entry: jiracmd.CmdTransitionsRegistry("debug")},
{Command: "unassign", Entry: jiracmd.CmdUnassignRegistry()},
{Command: "unexport-templates", Entry: jiracmd.CmdUnexportTemplatesRegistry()},
{Command: "view", Entry: jiracmd.CmdViewRegistry()},
{Command: "vote", Entry: jiracmd.CmdVoteRegistry()},
{Command: "watch", Entry: jiracmd.CmdWatchRegistry()},
{Command: "worklog add", Entry: jiracmd.CmdWorklogAddRegistry()},
{Command: "worklog list", Entry: jiracmd.CmdWorklogListRegistry(), Default: true},
}
jiracli.Register(app, o, fig, registry)
+1 -1
View File
@@ -7,7 +7,7 @@ import (
var log = logging.MustGetLogger("jira")
const VERSION = "1.0.8"
const VERSION = "1.0.11"
type Jira struct {
Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
+16 -14
View File
@@ -250,15 +250,17 @@ func (o *CommonOptions) editFile(fileName string) (changes bool, err error) {
return false, err
}
var EditLoopAbort = fmt.Errorf("Edit Loop aborted by request")
func EditLoop(opts *CommonOptions, input interface{}, output interface{}, submit func() error) error {
tmpFile, err := tmpTemplate(opts.Template.Value, input)
if err != nil {
return err
}
confirm := func(msg string) (answer bool) {
confirm := func(dflt bool, msg string) (answer bool) {
survey.AskOne(
&survey.Confirm{Message: msg, Default: true},
&survey.Confirm{Message: msg, Default: dflt},
&answer,
nil,
)
@@ -279,14 +281,14 @@ func EditLoop(opts *CommonOptions, input interface{}, output interface{}, submit
changes, err := opts.editFile(tmpFile)
if err != nil {
log.Error(err.Error())
if confirm("Editor reported an error, edit again?") {
if confirm(true, "Editor reported an error, edit again?") {
continue
}
panic(Exit{Code: 1})
return EditLoopAbort
}
if !changes {
if !confirm("No changes detected, submit anyway?") {
panic(Exit{Code: 1})
if !confirm(false, "No changes detected, submit anyway?") {
return EditLoopAbort
}
}
}
@@ -319,35 +321,35 @@ func EditLoop(opts *CommonOptions, input interface{}, output interface{}, submit
var raw interface{}
if err := yaml.Unmarshal(data, &raw); err != nil {
log.Error(err.Error())
if confirm("Invalid YAML syntax, edit again?") {
if confirm(true, "Invalid YAML syntax, edit again?") {
continue
}
panic(Exit{Code: 1})
return EditLoopAbort
}
yamlFixup(&raw)
fixedYAML, err := yaml.Marshal(&raw)
if err != nil {
log.Error(err.Error())
if confirm("Invalid YAML syntax, edit again?") {
if confirm(true, "Invalid YAML syntax, edit again?") {
continue
}
panic(Exit{Code: 1})
return EditLoopAbort
}
if err := yaml.Unmarshal(fixedYAML, output); err != nil {
log.Error(err.Error())
if confirm("Invalid YAML syntax, edit again?") {
if confirm(true, "Invalid YAML syntax, edit again?") {
continue
}
panic(Exit{Code: 1})
return EditLoopAbort
}
// submit template
if err := submit(); err != nil {
log.Error(err.Error())
if confirm("Jira reported an error, edit again?") {
if confirm(true, "Jira reported an error, edit again?") {
continue
}
panic(Exit{Code: 1})
return EditLoopAbort
}
break
}
+15 -13
View File
@@ -160,13 +160,13 @@ func TemplateProcessor() *template.Template {
}
func ConfigTemplate(fig *figtree.FigTree, template, command string, opts interface{}) (string, error) {
var tmp interface{}
var tmp map[string]interface{}
err := ConvertType(opts, &tmp)
if err != nil {
return "", err
}
fig.LoadAllConfigs(command+".yml", tmp)
fig.LoadAllConfigs("config.yml", tmp)
fig.LoadAllConfigs(command+".yml", &tmp)
fig.LoadAllConfigs("config.yml", &tmp)
tmpl, err := TemplateProcessor().Parse(template)
if err != nil {
@@ -261,14 +261,14 @@ const defaultDebugTemplate = "{{ . | toJson}}\n"
const defaultListTemplate = "{{ range .issues }}{{ .key | append \":\" | printf \"%-12s\"}} {{ .fields.summary }}\n{{ end }}"
const defaultTableTemplate = `{{/* table template */ -}}
{{$w := sub termWidth 92 -}}
+{{ "-" | rep 16 }}+{{ "-" | rep $w }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+{{ "-" | rep 12 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+
| {{ "Issue" | printf "%-14s" }} | {{ "Summary" | printf (printf "%%-%ds" (sub $w 2)) }} | {{ "Priority" | printf "%-12s" }} | {{ "Status" | printf "%-12s" }} | {{ "Age" | printf "%-10s" }} | {{ "Reporter" | printf "%-12s" }} | {{ "Assignee" | printf "%-12s" }} |
+{{ "-" | rep 16 }}+{{ "-" | rep $w }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+{{ "-" | rep 12 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+
{{$w := sub termWidth 107 -}}
+{{ "-" | rep 16 }}+{{ "-" | rep $w }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+{{ "-" | rep 12 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+
| {{ "Issue" | printf "%-14s" }} | {{ "Summary" | printf (printf "%%-%ds" (sub $w 2)) }} | {{ "Type" | printf "%-12s"}} | {{ "Priority" | printf "%-12s" }} | {{ "Status" | printf "%-12s" }} | {{ "Age" | printf "%-10s" }} | {{ "Reporter" | printf "%-12s" }} | {{ "Assignee" | printf "%-12s" }} |
+{{ "-" | rep 16 }}+{{ "-" | rep $w }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+{{ "-" | rep 12 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+
{{ range .issues -}}
| {{ .key | printf "%-14s"}} | {{ .fields.summary | abbrev (sub $w 2) | printf (printf "%%-%ds" (sub $w 2)) }} | {{.fields.priority.name | printf "%-12s" }} | {{.fields.status.name | printf "%-12s" }} | {{.fields.created | age | printf "%-10s" }} | {{if .fields.reporter}}{{ .fields.reporter.name | printf "%-12s"}}{{else}}<unassigned>{{end}} | {{if .fields.assignee }}{{.fields.assignee.name | printf "%-12s" }}{{else}}<unassigned>{{end}} |
| {{ .key | printf "%-14s"}} | {{ .fields.summary | abbrev (sub $w 2) | printf (printf "%%-%ds" (sub $w 2)) }} | {{.fields.issuetype.name | printf "%-12s" }} | {{.fields.priority.name | printf "%-12s" }} | {{.fields.status.name | printf "%-12s" }} | {{.fields.created | age | printf "%-10s" }} | {{if .fields.reporter}}{{ .fields.reporter.name | printf "%-12s"}}{{else}}<unassigned>{{end}} | {{if .fields.assignee }}{{.fields.assignee.name | printf "%-12s" }}{{else}}<unassigned>{{end}} |
{{ end -}}
+{{ "-" | rep 16 }}+{{ "-" | rep $w }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+{{ "-" | rep 12 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+
+{{ "-" | rep 16 }}+{{ "-" | rep $w }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+{{ "-" | rep 12 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+
`
const defaultAttachListTemplate = `{{/* table template */ -}}
+{{ "-" | rep 12 }}+{{ "-" | rep 30 }}+{{ "-" | rep 12 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+
@@ -326,7 +326,7 @@ comments:
{{end -}}
`
const defaultEditTemplate = `{{/* edit template */ -}}
# issue: {{ .key }}
# issue: {{ .key }} - created: {{ .fields.created | age}} ago
update:
comment:
- add:
@@ -352,9 +352,10 @@ fields:
- name: {{ .overrides.watcher}}{{end}}{{end}}
{{- if .meta.fields.priority }}
priority: # Values: {{ range .meta.fields.priority.allowedValues }}{{.name}}, {{end}}
name: {{ or .overrides.priority .fields.priority.name }}{{end}}
name: {{ or .overrides.priority .fields.priority.name "" }}{{end}}
description: |~
{{ or .overrides.description (or .fields.description "") | indent 4 }}
{{ or .overrides.description .fields.description "" | indent 4 }}
# votes: {{ .fields.votes.votes }}
# comments:
# {{ range .fields.comment.comments }} - | # {{.author.name}}, {{.created | age}} ago
# {{ or .body "" | indent 4 | comment}}
@@ -473,7 +474,8 @@ fields:
- name: {{ .name }}{{end}}{{end}}
{{- end -}}
{{if .meta.fields.description}}
description: {{or .overrides.description .fields.description }}
description: |~
{{ or .fields.description "" | indent 4 }}
{{- end -}}
{{if .meta.fields.fixVersions -}}
{{if .meta.fields.fixVersions.allowedValues}}
+1 -1
View File
@@ -24,7 +24,7 @@ func CmdAttachListRegistry() *jiracli.CommandRegistryEntry {
}
return &jiracli.CommandRegistryEntry{
"Prints issue details",
"Prints attachment details for issue",
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
jiracli.LoadConfigs(cmd, fig, &opts)
return CmdAttachListUsage(cmd, &opts)
+26 -4
View File
@@ -5,7 +5,7 @@ import (
"github.com/coryb/figtree"
"github.com/coryb/oreo"
"gopkg.in/AlecAivazis/survey.v1"
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
@@ -33,6 +33,9 @@ func CmdEditRegistry() *jiracli.CommandRegistryEntry {
"Edit issue details",
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
jiracli.LoadConfigs(cmd, fig, &opts)
if opts.QueryFields == "" {
opts.QueryFields = "assignee,created,priority,reporter,status,summary,updated,issuetype,comments,description,votes,created,customfield_10110,components"
}
return CmdEditUsage(cmd, &opts, fig)
},
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
@@ -100,12 +103,13 @@ func CmdEdit(o *oreo.Client, globals *jiracli.GlobalOptions, opts *EditOptions)
if opts.Browse.Value {
return CmdBrowse(globals, opts.Issue)
}
return nil
}
results, err := jira.Search(o, globals.Endpoint.Value, opts)
if err != nil {
return err
}
for _, issueData := range results.Issues {
for i, issueData := range results.Issues {
editMeta, err := jira.GetIssueEditMeta(o, globals.Endpoint.Value, issueData.Key)
if err != nil {
return err
@@ -113,12 +117,30 @@ func CmdEdit(o *oreo.Client, globals *jiracli.GlobalOptions, opts *EditOptions)
issueUpdate := jiradata.IssueUpdate{}
input := templateInput{
Issue: issueData,
Meta: editMeta,
Issue: issueData,
Meta: editMeta,
Overrides: opts.Overrides,
}
err = jiracli.EditLoop(&opts.CommonOptions, &input, &issueUpdate, func() error {
return jira.EditIssue(o, globals.Endpoint.Value, issueData.Key, &issueUpdate)
})
if err == jiracli.EditLoopAbort {
if len(results.Issues) > i+1 {
var answer bool
survey.AskOne(
&survey.Confirm{
Message: fmt.Sprintf("Continue to edit next issue %s?", results.Issues[i+1].Key),
Default: true,
},
&answer,
nil,
)
if answer {
continue
}
panic(jiracli.Exit{1})
}
}
if err != nil {
return err
}
+1 -1
View File
@@ -30,7 +30,7 @@ func CmdEpicListRegistry() *jiracli.CommandRegistryEntry {
opts.MaxResults = 500
}
if opts.QueryFields == "" {
opts.QueryFields = "assignee,created,priority,reporter,status,summary,updated"
opts.QueryFields = "assignee,created,priority,reporter,status,summary,updated,issuetype"
}
if opts.Sort == "" {
opts.Sort = "priority asc, key"
+1 -1
View File
@@ -31,7 +31,7 @@ func CmdListRegistry() *jiracli.CommandRegistryEntry {
opts.MaxResults = 500
}
if opts.QueryFields == "" {
opts.QueryFields = "assignee,created,priority,reporter,status,summary,updated"
opts.QueryFields = "assignee,created,priority,reporter,status,summary,updated,issuetype"
}
if opts.Sort == "" {
opts.Sort = "priority asc, key"
+4
View File
@@ -6,6 +6,10 @@ user: gojira
project: BASIC
queries:
todo: >-
resolution = unresolved {{if .project}}AND project = '{{.project}}'{{end}} AND status = 'To Do'
custom-commands:
- name: env
help: print the JIRA environment variables available to custom commands
+53 -6
View File
@@ -4,7 +4,7 @@ cd $(dirname $0)
jira="../jira"
. env.sh
PLAN 86
PLAN 94
# reset login
RUNS $jira logout
@@ -52,17 +52,64 @@ DIFF <<EOF
$(printf %-12s $issue:) summary
EOF
###############################################################################
## List issues using a named query
###############################################################################
RUNS $jira ls --project BASIC -n todo
DIFF <<EOF
$(printf %-12s $issue:) summary
EOF
###############################################################################
## List all issues, using the table template
###############################################################################
RUNS $jira ls --project BASIC --template table
DIFF <<EOF
+----------------+---------------------------------------------------------+--------------+--------------+------------+--------------+--------------+
| Issue | Summary | Priority | Status | Age | Reporter | Assignee |
+----------------+---------------------------------------------------------+--------------+--------------+------------+--------------+--------------+
| $(printf %-14s $issue) | summary | Medium | To Do | a minute | gojira | gojira |
+----------------+---------------------------------------------------------+--------------+--------------+------------+--------------+--------------+
+----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
+----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
| $(printf %-14s $issue) | summary | Bug | Medium | To Do | a minute | gojira | gojira |
+----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
EOF
###############################################################################
## Edit an issue
###############################################################################
RUNS $jira edit $issue -m "edit comment" --override priority=High --noedit
DIFF <<EOF
OK $issue $ENDPOINT/browse/$issue
EOF
###############################################################################
## Edit multiple issues with query
###############################################################################
RUNS $jira edit -m "bulk edit comment" --override priority=High --noedit --query "resolution = unresolved AND project = 'BASIC' AND status = 'To Do'"
DIFF <<EOF
OK $issue $ENDPOINT/browse/$issue
EOF
RUNS $jira $issue
DIFF <<EOF
issue: $issue
created: a minute ago
status: To Do
summary: summary
project: BASIC
issuetype: Bug
assignee: gojira
reporter: gojira
priority: High
votes: 0
description: |
description
comments:
- | # gojira, a minute ago
edit comment
- | # gojira, a minute ago
bulk edit comment
EOF
###############################################################################
+5 -5
View File
@@ -72,9 +72,9 @@ EOF
RUNS $jira mine
DIFF <<EOF
+----------------+---------------------------------------------------------+--------------+--------------+------------+--------------+--------------+
| Issue | Summary | Priority | Status | Age | Reporter | Assignee |
+----------------+---------------------------------------------------------+--------------+--------------+------------+--------------+--------------+
| $(printf %-14s $issue) | summary | Medium | To Do | a minute | gojira | gojira |
+----------------+---------------------------------------------------------+--------------+--------------+------------+--------------+--------------+
+----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
+----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
| $(printf %-14s $issue) | summary | Bug | Medium | To Do | a minute | gojira | gojira |
+----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
EOF
+19 -19
View File
@@ -46,10 +46,10 @@ EOF
RUNS $jira epic list $epic
DIFF<<EOF
+----------------+---------------------------------------------------------+--------------+--------------+------------+--------------+--------------+
| Issue | Summary | Priority | Status | Age | Reporter | Assignee |
+----------------+---------------------------------------------------------+--------------+--------------+------------+--------------+--------------+
+----------------+---------------------------------------------------------+--------------+--------------+------------+--------------+--------------+
+----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
+----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
+----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
EOF
###############################################################################
@@ -69,12 +69,12 @@ EOF
RUNS $jira epic list $epic
DIFF<<EOF
+----------------+---------------------------------------------------------+--------------+--------------+------------+--------------+--------------+
| Issue | Summary | Priority | Status | Age | Reporter | Assignee |
+----------------+---------------------------------------------------------+--------------+--------------+------------+--------------+--------------+
| $(printf %-14s $issue1) | summary | Medium | To Do | a minute | gojira | gojira |
| $(printf %-14s $issue2) | summary | Medium | To Do | a minute | gojira | gojira |
+----------------+---------------------------------------------------------+--------------+--------------+------------+--------------+--------------+
+----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
+----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
| $(printf %-14s $issue1) | summary | Bug | Medium | To Do | a minute | gojira | gojira |
| $(printf %-14s $issue2) | summary | Bug | Medium | To Do | a minute | gojira | gojira |
+----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
EOF
###############################################################################
@@ -92,11 +92,11 @@ EOF
RUNS $jira epic list $epic
DIFF<<EOF
+----------------+---------------------------------------------------------+--------------+--------------+------------+--------------+--------------+
| Issue | Summary | Priority | Status | Age | Reporter | Assignee |
+----------------+---------------------------------------------------------+--------------+--------------+------------+--------------+--------------+
| $(printf %-14s $issue2) | summary | Medium | To Do | a minute | gojira | gojira |
+----------------+---------------------------------------------------------+--------------+--------------+------------+--------------+--------------+
+----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
+----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
| $(printf %-14s $issue2) | summary | Bug | Medium | To Do | a minute | gojira | gojira |
+----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
EOF
###############################################################################
@@ -114,8 +114,8 @@ EOF
RUNS $jira epic list $epic
DIFF<<EOF
+----------------+---------------------------------------------------------+--------------+--------------+------------+--------------+--------------+
| Issue | Summary | Priority | Status | Age | Reporter | Assignee |
+----------------+---------------------------------------------------------+--------------+--------------+------------+--------------+--------------+
+----------------+---------------------------------------------------------+--------------+--------------+------------+--------------+--------------+
+----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
+----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
+----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
EOF