mirror of
https://github.com/Threnklyn/jira.git
synced 2026-05-19 20:53:27 +02:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5b5f0d5ed4 | |||
| ddee8a58a9 |
@@ -1,2 +0,0 @@
|
||||
# one of these users must approve the PR before merging
|
||||
* @coryb @mvdan @vanniktech @mikepea
|
||||
+8
-10
@@ -1,12 +1,10 @@
|
||||
jira
|
||||
schemas/*.json
|
||||
/_t/.gnupg/random_seed
|
||||
/_t/issue.props
|
||||
/_t/attach.props
|
||||
/_t/garbage.bin
|
||||
/_t/attach1.txt
|
||||
/_t/binary.out
|
||||
/_t/foobar.bin
|
||||
/_t/.password-store/GoJira/api-token:gojira@corybennett.org.gpg
|
||||
/_t/.password-store/GoJira/api-token:mothra@corybennett.org.gpg
|
||||
dist
|
||||
t/.gnupg/random_seed
|
||||
t/issue.props
|
||||
t/attach.props
|
||||
t/garbage.bin
|
||||
t/attach1.txt
|
||||
t/binary.out
|
||||
t/foobar.bin
|
||||
dist
|
||||
+10
-12
@@ -1,21 +1,19 @@
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- pass
|
||||
- gnupg
|
||||
sudo: true
|
||||
before_install:
|
||||
- sudo apt-get update && sudo apt-get install -y pass gnupg
|
||||
|
||||
language: go
|
||||
|
||||
go_import_path: gopkg.in/Netflix-Skunkworks/go-jira.v1
|
||||
go:
|
||||
- 1.12.x
|
||||
- 1.13.x
|
||||
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
- 1.9
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
|
||||
script:
|
||||
- go get -t -v ./...
|
||||
- go test ./...
|
||||
- go vet -composites=false ./...
|
||||
- make
|
||||
- make all
|
||||
- make prove 2>&1
|
||||
|
||||
|
||||
@@ -1,29 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## 1.0.22 - 2019-09-30
|
||||
|
||||
* fix syntax [Cory Bennett] [[807ca76](https://github.com/Netflix-Skunkworks/go-jira/commit/807ca76)]
|
||||
* Address comments for direct name match [Patrick Cockwell] [[a70384b](https://github.com/Netflix-Skunkworks/go-jira/commit/a70384b)]
|
||||
* Choose exact transition match if available [Patrick Cockwell] [[a646f76](https://github.com/Netflix-Skunkworks/go-jira/commit/a646f76)]
|
||||
|
||||
|
||||
## 1.0.21 - 2019-09-16
|
||||
|
||||
* [[#277](https://github.com/Netflix-Skunkworks/go-jira/issues/277)] update figtree to latest [Cory Bennett] [[0e520a4](https://github.com/Netflix-Skunkworks/go-jira/commit/0e520a4)]
|
||||
* Switch over to using github.com/Kuchenm0nster/jira, from gopkg.in [Mike Pountney] [[27f57b2](https://github.com/Netflix-Skunkworks/go-jira/commit/27f57b2)]
|
||||
* fix worklog template to allow multiline comments [Matthias Bethke] [[43e07f1](https://github.com/Netflix-Skunkworks/go-jira/commit/43e07f1)]
|
||||
* Allow reading password from stdin [Justin Ko] [[225e1dc](https://github.com/Netflix-Skunkworks/go-jira/commit/225e1dc)]
|
||||
* all: unindent some code [Daniel Martí] [[31c113d](https://github.com/Netflix-Skunkworks/go-jira/commit/31c113d)]
|
||||
* don't use ReadAll when decoding JSON [Daniel Martí] [[9bcdcc1](https://github.com/Netflix-Skunkworks/go-jira/commit/9bcdcc1)]
|
||||
* start making staticcheck happier [Daniel Martí] [[9b9186f](https://github.com/Netflix-Skunkworks/go-jira/commit/9b9186f)]
|
||||
* all: convert to a Go module [Daniel Martí] [[f125ef3](https://github.com/Netflix-Skunkworks/go-jira/commit/f125ef3)]
|
||||
* CI: test on Go 1.12.x, cleanup [Daniel Martí] [[664c5ca](https://github.com/Netflix-Skunkworks/go-jira/commit/664c5ca)]
|
||||
* make automatic pagination on search optional, fix tests [Cory Bennett] [[36c99ce](https://github.com/Netflix-Skunkworks/go-jira/commit/36c99ce)]
|
||||
* prefer defer resp.Body.Close to avoid leaks on subsequent errors [Cory Bennett] [[181bd74](https://github.com/Netflix-Skunkworks/go-jira/commit/181bd74)]
|
||||
* add pagination to search [Miles Maddox] [[76dd1d8](https://github.com/Netflix-Skunkworks/go-jira/commit/76dd1d8)]
|
||||
* Fix function comments based on best practices from Effective Go [CodeLingo Bot] [[23ac118](https://github.com/Netflix-Skunkworks/go-jira/commit/23ac118)]
|
||||
* [[#201](https://github.com/Netflix-Skunkworks/go-jira/issues/201)] update required library, failing to populate cookiejar from cookies file [Cory Bennett] [[ee69afa](https://github.com/Netflix-Skunkworks/go-jira/commit/ee69afa)]
|
||||
|
||||
## 1.0.20 - 2018-08-04
|
||||
|
||||
* [[#201](https://github.com/Netflix-Skunkworks/go-jira/issues/201)] update required library, failing to populate cookiejar from cookies file [Cory Bennett] [[ee69afa](https://github.com/Netflix-Skunkworks/go-jira/commit/ee69afa)]
|
||||
|
||||
Generated
+193
@@ -0,0 +1,193 @@
|
||||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
||||
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/alecthomas/template"
|
||||
packages = [
|
||||
".",
|
||||
"parse"
|
||||
]
|
||||
revision = "a0175ee3bccc567396460bf5acd36800cb10c49c"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/alecthomas/units"
|
||||
packages = ["."]
|
||||
revision = "2efee857e7cfd4f3d0138cc3cbb1b4966962b93a"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/cheekybits/genny"
|
||||
packages = ["generic"]
|
||||
revision = "c546fedd85a9b2291805f7a2933a3564cbdda989"
|
||||
source = "github.com/coryb/genny"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/coryb/figtree"
|
||||
packages = ["."]
|
||||
revision = "071d1ef303dfb7738166ba62aac71e5ee10ce218"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/coryb/kingpeon"
|
||||
packages = ["."]
|
||||
revision = "9a669f143f2e7454e80064c47365d139420a3fff"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/coryb/oreo"
|
||||
packages = ["."]
|
||||
revision = "3e1b88fc08f134aa91ccfb5d58c983ca8ab42589"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/davecgh/go-spew"
|
||||
packages = ["spew"]
|
||||
revision = "346938d642f2ec3594ed81d874461961cd0faa76"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/fatih/camelcase"
|
||||
packages = ["."]
|
||||
revision = "44e46d280b43ec1531bb25252440e34f1b800b65"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/guelfey/go.dbus"
|
||||
packages = ["."]
|
||||
revision = "f6a3a2366cc39b8479cadc499d3c735fb10fbdda"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/jinzhu/copier"
|
||||
packages = ["."]
|
||||
revision = "7e38e58719c33e0d44d585c4ab477a30f8cb82dd"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/kballard/go-shellquote"
|
||||
packages = ["."]
|
||||
revision = "95032a82bc518f77982ea72343cc1ade730072f0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/mattn/go-colorable"
|
||||
packages = ["."]
|
||||
revision = "167de6bfdfba052fa6b2d3664c8f5272e23c9072"
|
||||
version = "v0.0.9"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/mattn/go-isatty"
|
||||
packages = ["."]
|
||||
revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39"
|
||||
version = "v0.0.3"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/mgutz/ansi"
|
||||
packages = ["."]
|
||||
revision = "9520e82c474b0a04dd04f8a40959027271bab992"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/pkg/browser"
|
||||
packages = ["."]
|
||||
revision = "c90ca0c84f15f81c982e32665bffd8d7aac8f097"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/pkg/errors"
|
||||
packages = ["."]
|
||||
revision = "645ef00459ed84a119197bfb8d8205042c6df63d"
|
||||
version = "v0.8.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/pmezard/go-difflib"
|
||||
packages = ["difflib"]
|
||||
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/stretchr/testify"
|
||||
packages = ["assert"]
|
||||
revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686"
|
||||
version = "v1.2.2"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/theckman/go-flock"
|
||||
packages = ["."]
|
||||
revision = "b139a2487364247d91814e4a7c7b8fdc69e342b2"
|
||||
version = "v0.4.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/tidwall/gjson"
|
||||
packages = ["."]
|
||||
revision = "ba784d767ac7d937cf2439f237e50ec04a381c8b"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/tidwall/match"
|
||||
packages = ["."]
|
||||
revision = "1731857f09b1f38450e2c12409748407822dc6be"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/tmc/keyring"
|
||||
packages = ["."]
|
||||
revision = "839169085ae146fc7a34bcb34dfd7ab216d23991"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/crypto"
|
||||
packages = ["ssh/terminal"]
|
||||
revision = "c126467f60eb25f8f27e5a981f32a87e3965053f"
|
||||
|
||||
[[projects]]
|
||||
name = "golang.org/x/net"
|
||||
packages = ["proxy"]
|
||||
revision = "01c190206fbdffa42f334f4b2bf2220f50e64920"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/sys"
|
||||
packages = [
|
||||
"unix",
|
||||
"windows"
|
||||
]
|
||||
revision = "bd9dbc187b6e1dacfdd2722a87e83093c2d7bd6e"
|
||||
|
||||
[[projects]]
|
||||
name = "gopkg.in/AlecAivazis/survey.v1"
|
||||
packages = [
|
||||
".",
|
||||
"core",
|
||||
"terminal"
|
||||
]
|
||||
revision = "17861e192dc11fd2f5081df1932c94cce262fa1e"
|
||||
version = "v1.6.1"
|
||||
|
||||
[[projects]]
|
||||
name = "gopkg.in/alecthomas/kingpin.v2"
|
||||
packages = ["."]
|
||||
revision = "947dcec5ba9c011838740e680966fd7087a71d0d"
|
||||
version = "v2.2.6"
|
||||
|
||||
[[projects]]
|
||||
branch = "v2"
|
||||
name = "gopkg.in/coryb/yaml.v2"
|
||||
packages = ["."]
|
||||
revision = "0e40e46f7153ceb79ebbfdd075233d57f9611bd1"
|
||||
|
||||
[[projects]]
|
||||
name = "gopkg.in/op/go-logging.v1"
|
||||
packages = ["."]
|
||||
revision = "b2cb9fa56473e98db8caba80237377e83fe44db5"
|
||||
version = "v1"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "e087b3c5e03a82796f3bbc9d67c366dd794718c12f9ef9252e6172a6344c4fd7"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
|
||||
# Gopkg.toml example
|
||||
#
|
||||
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
|
||||
# for detailed Gopkg.toml documentation.
|
||||
#
|
||||
# required = ["github.com/user/thing/cmd/thing"]
|
||||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
|
||||
#
|
||||
# [[constraint]]
|
||||
# name = "github.com/user/project"
|
||||
# version = "1.0.0"
|
||||
#
|
||||
# [[constraint]]
|
||||
# name = "github.com/user/project2"
|
||||
# branch = "dev"
|
||||
# source = "github.com/myfork/project2"
|
||||
#
|
||||
# [[override]]
|
||||
# name = "github.com/x/y"
|
||||
# version = "2.4.0"
|
||||
|
||||
[prune]
|
||||
go-tests = true
|
||||
unused-packages = true
|
||||
non-go = true
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/coryb/figtree"
|
||||
branch = "master"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/coryb/kingpeon"
|
||||
branch = "master"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/coryb/oreo"
|
||||
branch = "master"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/jinzhu/copier"
|
||||
branch = "master"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/kballard/go-shellquote"
|
||||
branch = "master"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/mgutz/ansi"
|
||||
branch = "master"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/pkg/browser"
|
||||
branch = "master"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/pkg/errors"
|
||||
version = "0.8.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/tmc/keyring"
|
||||
branch = "master"
|
||||
|
||||
[[constraint]]
|
||||
name = "golang.org/x/crypto"
|
||||
branch = "master"
|
||||
|
||||
[[constraint]]
|
||||
name = "gopkg.in/AlecAivazis/survey.v1"
|
||||
version = "1.3.1"
|
||||
|
||||
[[constraint]]
|
||||
name = "gopkg.in/alecthomas/kingpin.v2"
|
||||
version = "2.2.5"
|
||||
|
||||
[[constraint]]
|
||||
name = "gopkg.in/coryb/yaml.v2"
|
||||
branch = "v2"
|
||||
|
||||
[[constraint]]
|
||||
name = "gopkg.in/op/go-logging.v1"
|
||||
version = "1.0.0"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/tidwall/gjson"
|
||||
|
||||
[[constraint]]
|
||||
name = "golang.org/x/net"
|
||||
revision = "01c190206fbdffa42f334f4b2bf2220f50e64920"
|
||||
@@ -39,11 +39,10 @@ lint:
|
||||
@golint ./cmd/jira
|
||||
|
||||
all:
|
||||
GO111MODULE=off $(GO) get -u github.com/mitchellh/gox
|
||||
$(GO) get -u github.com/karalabe/xgo
|
||||
rm -rf dist
|
||||
mkdir -p dist
|
||||
gox -ldflags="-w -s" -output="dist/github.com/Kuchenm0nster/jira-{{.OS}}-{{.Arch}}" -osarch="darwin/amd64 linux/386 linux/amd64 windows/386 windows/amd64" ./...
|
||||
_t/test_binaries.sh
|
||||
xgo --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
|
||||
@@ -81,20 +80,12 @@ release:
|
||||
version:
|
||||
@echo $(CURVER)
|
||||
|
||||
clean: clean-password-store
|
||||
clean:
|
||||
rm -rf ./$(NAME)
|
||||
|
||||
clean-password-store:
|
||||
rm -f "$(CWD)/_t/.password-store/GoJira/api-token:gojira@corybennett.org.gpg"
|
||||
rm -f "$(CWD)/_t/.password-store/GoJira/api-token:mothra@corybennett.org.gpg"
|
||||
|
||||
test-password-store:
|
||||
ln -s "api-token__gojira@corybennett.org.gpg" "$(CWD)/_t/.password-store/GoJira/api-token:gojira@corybennett.org.gpg"
|
||||
ln -s "api-token__mothra@corybennett.org.gpg" "$(CWD)/_t/.password-store/GoJira/api-token:mothra@corybennett.org.gpg"
|
||||
|
||||
prove: test-password-store
|
||||
chmod -R g-rwx,o-rwx $(CWD)/_t/.gnupg
|
||||
OSHT_VERBOSE=1 prove -v _t/*.t
|
||||
prove:
|
||||
chmod -R g-rwx,o-rwx $(CWD)/t/.gnupg
|
||||
OSHT_VERBOSE=1 prove -v
|
||||
|
||||
generate:
|
||||
cd schemas && ./fetch-schemas.py
|
||||
|
||||
@@ -1,33 +1,72 @@
|
||||
[](https://travis-ci.org/go-jira/jira)
|
||||
[](https://godoc.org/github.com/go-jira/jira)
|
||||
[](https://gitter.im/go-jira-cli/help?utm_source=badge&utm_medium=badge&utm_content=badge)
|
||||
[](https://travis-ci.org/Netflix-Skunkworks/go-jira)
|
||||
[](https://godoc.org/gopkg.in/Netflix-Skunkworks/go-jira.v1)
|
||||
[](https://opensource.org/licenses/Apache-2.0)
|
||||
|
||||
# go-jira
|
||||
### Table of Contents
|
||||
|
||||
Simple command line client for Atlassian's Jira service written in Go.
|
||||
* [Summary](#go-jira)
|
||||
* [Install](#install)
|
||||
* [Download](#download)
|
||||
* [Build](#build)
|
||||
* [Usage](#usage)
|
||||
* [TAB completion](#setting-up-tab-completion)
|
||||
* [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)
|
||||
* [user vs login](#user-vs-login)
|
||||
* [keyring password source](#keyring-password-source)
|
||||
* [pass password source](#pass-password-source)
|
||||
|
||||
# go-jira
|
||||
simple command line client for Atlassian's Jira service written in Go
|
||||
|
||||
## Install
|
||||
|
||||
### Download
|
||||
|
||||
You can download one of the pre-built binaries for **go-jira** [here](https://github.com/Kuchenm0nster/jira/releases).
|
||||
You can download one of the pre-built binaries for **go-jira** [here](https://github.com/Netflix-Skunkworks/go-jira/releases).
|
||||
|
||||
### Build
|
||||
|
||||
You can build and install the official repository with [Go](https://golang.org/dl/):
|
||||
|
||||
go get github.com/Kuchenm0nster/jira/cmd/jira
|
||||
```
|
||||
go get gopkg.in/Netflix-Skunkworks/go-jira.v1/cmd/jira
|
||||
```
|
||||
This will checkout this repository into `$GOPATH/src/gopkg.in/Netflix-Skunkworks/go-jira.v1`, build, and install it.
|
||||
|
||||
This will checkout this repository into `$GOPATH/src/github.com/Kuchenm0nster/jira/`, build, and install it.
|
||||
Because golang likes fully qualified import paths, forking and contributing can be a bit tricky.
|
||||
|
||||
It should then be available in $GOPATH/bin/jira
|
||||
If you want to tinker or hack on go-jira, the [easiest way to do so](http://code.openark.org/blog/development/forking-golang-repositories-on-github-and-managing-the-import-path) is to fork the repository and clone directly into the official path like this:
|
||||
|
||||
`git clone https://github.com/YOUR_USER_NAME_HERE/go-jira $GOPATH/src/gopkg.in/Netflix-Skunkworks/go-jira.v1`
|
||||
|
||||
From within that source dir you can build and install modifications from within that directory like:
|
||||
|
||||
`go install ./...`
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
#### Setting up TAB completion
|
||||
|
||||
Since go-jira is built with the "kingpin" golang command line library we support bash/zsh shell completion automatically:
|
||||
Since go-jira is build with the "kingpin" golang command line library we supports bash/zsh shell completion automatically:
|
||||
|
||||
* <https://github.com/alecthomas/kingpin/tree/v2.2.5#bashzsh-shell-completion>
|
||||
|
||||
@@ -37,6 +76,153 @@ For example, in bash, adding something along the lines of:
|
||||
|
||||
to your bashrc, or .profile (assuming go-jira binary is already in your path) will cause jira to offer tab completion behavior.
|
||||
|
||||
```
|
||||
usage: jira [<flags>] <command> [<args> ...]
|
||||
|
||||
Jira Command Line Interface
|
||||
|
||||
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
|
||||
-k, --insecure Disable TLS certificate verification
|
||||
-Q, --quiet Suppress output to console
|
||||
--unixproxy=UNIXPROXY Path for a unix-socket proxy
|
||||
--socksproxy=SOCKSPROXY Address for a socks proxy
|
||||
-u, --user=USER user name used within the Jira service
|
||||
--login=LOGIN login name that corresponds to the user used for authentication
|
||||
|
||||
Commands:
|
||||
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 session 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
|
||||
session: Attempt to login into jira server
|
||||
|
||||
```
|
||||
|
||||
## v1 vs v0 changes
|
||||
|
||||
###### **Golang library import**
|
||||
For the new version of go-jira you should use:
|
||||
```
|
||||
import "gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
```
|
||||
|
||||
If you have code that depends on the old apis, you can still use them with this import:
|
||||
```
|
||||
import "gopkg.in/Netflix-Skunkworks/go-jira.v0"
|
||||
```
|
||||
|
||||
###### **Configs per command**
|
||||
Instead of requiring a executable template to get configs for a given command now you can create a config to be applied to a command. So if you want to use `template: table` by default for your `jira list` you can now do:
|
||||
```
|
||||
$ cat $HOME/.jira.d/list.yml
|
||||
template: table
|
||||
```
|
||||
Where previously you needed something like:
|
||||
```
|
||||
# cat $HOME/.jira.d/config.yml
|
||||
#!/bin/sh
|
||||
case $JIRA_OPERATION in
|
||||
list)
|
||||
echo "template: table";;
|
||||
esac
|
||||
```
|
||||
|
||||
###### **Custom Commands**
|
||||
Now you can create your own custom commands to do common operations with jira. Please see the details **Custom Commands** section below for more details. If you want to create a command `jira mine` that lists all the issues assigned to you now you can modify your `.jira.d/config.yml` file to add a `custom-commands` section like this:
|
||||
```yaml
|
||||
custom-commands:
|
||||
- name: mine
|
||||
help: display issues assigned to me
|
||||
script: |-
|
||||
{{jira}} list --query "resolution = unresolved and assignee=currentuser() ORDER BY created"
|
||||
```
|
||||
Then the next time you run `jira help` you will see your usage:
|
||||
```
|
||||
$ jira mine --help
|
||||
usage: jira mine
|
||||
|
||||
display issues assigned to me
|
||||
|
||||
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
|
||||
-u, --user=USER Login name used for authentication with Jira service
|
||||
--unixproxy=UNIXPROXY Path for a unix-socket proxy
|
||||
-k, --insecure Disable TLS certificate verification
|
||||
```
|
||||
|
||||
###### **Incompatible command changes**
|
||||
Unfortunately during the rewrite between v0 and v1 there were some necessary changes that broke backwards compatibility with existing commands. Specifically the `dups`, `blocks`, `add worklog` and `add|remove|set labels` commands have had the command word swapped around:
|
||||
* `jira DUPLICATE dups ISSUE` => `jira dup DUPLICATE ISSUE`
|
||||
* `jira BLOCKER blocks ISSUE` => `jira block BLOCKER ISSUE`
|
||||
* `jira add worklog` => `jira worklog add`
|
||||
* `jira add labels` => `jira labels add`
|
||||
* `jira remove labels` => `jira labels remove`
|
||||
* `jira set labels` => `jira labels set`
|
||||
|
||||
###### **Login process change**
|
||||
We have, once again, changed how login happens for Jira. When authenticating against Atlassian Cloud Jira [API Tokens are now required](https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-basic-auth-and-cookie-based-auth/). Please read [the Authentication section](#authentication) below for more information.
|
||||
|
||||
If you use a privately hosted Jira service, you can chose to use the API Token method or continue using the session login api. Please read [the Authentication section](#authentication) below for more information.
|
||||
|
||||
Previously `jira` used attempt to get a `JSESSION` cookies by authenticating with the webservice standard GUI login process. This has been especially problematic as users need to authenticate with various credential providers (google auth, etc). We now attempt to authenticate via the [session login api](https://docs.atlassian.com/jira/REST/cloud/#auth/1/session-login). This may be problematic for users if admins have locked down the session-login api, so we might have to bring back the error-prone Basic-Auth approach. For users that are unable to authenticate via `jira` hopefully someone in your organization can provide me with details on a process for you to authenticate and we can try to update `jira`.
|
||||
|
||||
## Configuration
|
||||
|
||||
**go-jira** uses a configuration hierarchy. When loading the configuration from disk it will recursively look through all parent directories in your current path looking for a **.jira.d** directory. If your current directory is not a child directory of your homedir, then your homedir will also be inspected for a **.jira.d** directory. From all of **.jira.d** directories discovered **go-jira** will load a **<command>.yml** file (ie for `jira list` it will load `.jira.d/list.yml`) then it will merge in any properties from the **config.yml** if found. The configuration properties found in a file closest to your current working directory will have precedence. Properties overridden with command line options will have final precedence.
|
||||
@@ -260,7 +446,7 @@ hard-coded templates with `jira export-templates` which will write them to **~/.
|
||||
|
||||
#### Writing/Editing Templates
|
||||
|
||||
First the basic templating functionality is defined by the Go language 'text/template' library. The library reference documentation can be found [here](https://golang.org/pkg/text/template/), and there is a good primer document [here](https://gohugo.io/templates/go-templates/). `go-jira` also provides a few extra helper functions to make it a bit easier to format the data, those functions are defined [here](https://github.com/Kuchenm0nster/jira/blob/master/jiracli/templates.go#L64).
|
||||
First the basic templating functionality is defined by the Go language 'text/template' library. The library reference documentation can be found [here](https://golang.org/pkg/text/template/), and there is a good primer document [here](https://gohugo.io/templates/go-templates/). `go-jira` also provides a few extra helper functions to make it a bit easier to format the data, those functions are defined [here](https://github.com/Netflix-Skunkworks/go-jira/blob/master/jiracli/templates.go#L64).
|
||||
|
||||
Knowing what data and fields are available to any given template is not obvious. The easiest approach to determine what is available is to use the `debug` template on any given operation. For example to find out what is available to the "view" templates, you can use:
|
||||
```
|
||||
@@ -274,11 +460,9 @@ jira list -t debug
|
||||
|
||||
### Authentication
|
||||
|
||||
For Atlassian Cloud hosted Jira [API Tokens are now required](https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-basic-auth-and-cookie-based-auth/). You will automatically be prompted for an API Token if your jira endpoint ends in `.atlassian.net`. If you are using a private Jira service, you can force `jira` to use an api-token by setting the `authentication-method: api-token` property in your `$HOME/.jira.d/config.yml` file. The API Token needs to be presented to the Jira service on every request, so it is recommended to store this API Token security within your OS's keyring, or using the `pass`/`gopass` service as documented below so that it can be programmatically accessed via `jira` and not prompt you every time. For a less-secure option you can also provide the API token via a `JIRA_API_TOKEN` environment variable. If you are unable to use an api-token for an Atlassian Cloud hosted Jira then you can still force `jira` to use the old session based authentication (until it the hosted system stops accepting it) by setting `authentication-method: session`.
|
||||
For Atlassian Cloud hosted Jira [API Tokens are now required](https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-basic-auth-and-cookie-based-auth/). You will automatically be prompted for an API Token if your jira endpoint ends in `.atlassian.net`. If you are using a private Jira service, you can force `jira` to use an api-token by setting the `authentication-method: api-token` property in your `$HOME/.jira.d/config.yml` file. The API Token needs to be presented to the Jira service on every request, so it is recommended to store this API Token security within your OS's keyring, or using the `pass` service as documented below so that it can be programmatically accessed via `jira` and not prompt you every time. For a less-secure option you can also provide the API token via a `JIRA_API_TOKEN` environment variable. If you are unable to use an api-token for an Atlassian Cloud hosted Jira then you can still force `jira` to use the old session based authentication (until it the hosted system stops accepting it) by setting `authentication-method: session`.
|
||||
|
||||
The API Token authentication requires both the token and the email of the user. The email mut be set in the `user:` in your config.yml. Failure to provide the `user` will result in a 401 error.
|
||||
|
||||
If your Jira service still allows you to use the Session based authentication method then `jira` will prompt for a password automatically when get a response header from the Jira service that indicates you do not have an active session (ie the `X-Ausername` header is set to `anonymous`). Then after authentication we cache the `cloud.session.token` cookie returned by the service [session login api](https://docs.atlassian.com/jira/REST/cloud/#auth/1/session-login) and reuse that on subsequent requests. Typically this cookie will be valid for several hours (depending on the service configuration). To automatically securely store your password for easy reuse by jira You can enable a `password-source` via `.jira.d/config.yml` with possible values of `keyring`, `pass` or `gopass`.
|
||||
If your Jira service still allows you to use the Session based authentication method then `jira` will prompt for a password automatically when get a response header from the Jira service that indicates you do not have an active session (ie the `X-Ausername` header is set to `anonymous`). Then after authentication we cache the `cloud.session.token` cookie returned by the service [session login api](https://docs.atlassian.com/jira/REST/cloud/#auth/1/session-login) and reuse that on subsequent requests. Typically this cookie will be valid for several hours (depending on the service configuration). To automatically securely store your password for easy reuse by jira You can enable a `password-source` via `.jira.d/config.yml` with possible values of `keyring` or `pass`.
|
||||
|
||||
#### User vs Login
|
||||
The Jira service has sometimes differing opinions about how a user is identified. In other words the ID you login with might not be ID that the jira system recognized you as. This matters when trying to identify a user via various Jira REST APIs (like issue assignment). This is especially relevant when trying to authenticate with an API Token where the authentication user is usually an email address, but within the Jira system the user is identified by a user name. To accommodate this `jira` now supports two different properties in the config file. So when authentication using the API Tokens you will likely want something like this in your `$HOME/.jira.d/config.yml` file:
|
||||
@@ -289,7 +473,7 @@ login: person@example.com
|
||||
|
||||
You can also override these values on the command line with `jira --user person --login person@example.com`. The `login` value will be used only for authentication purposes, the `user` value will be used when a user name is required for any Jira service API calls.
|
||||
|
||||
#### `keyring` password source
|
||||
#### keyring password source
|
||||
On OSX and Linux there are a few keyring providers that `go-jira` can use (via this [golang module](https://github.com/tmc/keyring)). To integrate `go-jira` with a supported keyring just add this configuration to `$HOME/.jira.d/config.yml`:
|
||||
```yaml
|
||||
password-source: keyring
|
||||
@@ -300,7 +484,6 @@ After setting this and issuing a `jira login`, your credentials will be stored i
|
||||
An alternative to the keyring password source is the `pass` tool (documentation [here](https://www.passwordstore.org/)). This uses gpg to encrypt/decrypt passwords on demand and by using `gpg-agent` you can cache the gpg credentials for a period of time so you will not be prompted repeatedly for decrypting the passwords. The advantage over the keyring integration is that `pass` can be used on more platforms than OSX and Linux, although it does require more setup. To use `pass` for password storage and retrieval via `go-jira` just add this configuration to `$HOME/.jira.d/config.yml`:
|
||||
```yaml
|
||||
password-source: pass
|
||||
password-name: jira.example.com/myuser
|
||||
```
|
||||
|
||||
This assumes you have already setup `pass` correctly on your system. Specifically you will need to have created a gpg key like this:
|
||||
@@ -324,12 +507,6 @@ Then initialize the `pass` tool to use the correct key:
|
||||
$ pass init "Go Jira <gojira@example.com>"
|
||||
```
|
||||
|
||||
Now insert your password with the name you configured.
|
||||
|
||||
```
|
||||
$ pass insert jira.example.com/myuser
|
||||
```
|
||||
|
||||
You probably want to setup gpg-agent so that you don't have to type in your gpg passphrase all the time. You can get `gpg-agent` to automatically start by adding something like this to your `$HOME/.bashrc`
|
||||
```bash
|
||||
if [ -f $HOME/.gpg-agent-info ]; then
|
||||
@@ -355,38 +532,3 @@ if [ -n "${GPG_AGENT_INFO}" ]; then
|
||||
fi
|
||||
export GPG_TTY=$(tty)
|
||||
```
|
||||
|
||||
#### `gopass` password source
|
||||
There is also the possibility to use [gopass](https://www.gopass.pw/) as a password source. `gopass` (like `pass`) uses gpg to encrypt/decrypt passwords. To use `gopass` for password storagte and retrieval via `go-jira` just add this configuration to `$HOME/.jira.d/config.yml`:
|
||||
```yaml
|
||||
password-source: gopass
|
||||
password-name: jira.example.com/myuser
|
||||
```
|
||||
|
||||
For this to work, you need a working `gopass` installation.
|
||||
|
||||
To configure your `gpg-agent` to cache your gpg passphrase take a look at the `pass` section of the readme.
|
||||
|
||||
#### `stdin` password source
|
||||
|
||||
When `password-source` is set to `stdin`, the `jira login` command will read from stdin until EOF, and the bytes read will be the used as the password. This is useful if you have some other programmatic method for fetching passwords. For example, if `password-generator` creates a one-time password and prints it to stdout, you could use it like this.
|
||||
|
||||
```bash
|
||||
$ ./password-generator | jira login --endpoint=https://my.jira.endpoint.com --user=USERNAME
|
||||
```
|
||||
|
||||
#### Switch path used for password source
|
||||
For `gopass` and `pass` it is possible to specify the full path for the `password-source` tool used for retrieval of the password. This can be accomplised
|
||||
by setting the `password-source-path` option in the configuration file.
|
||||
|
||||
E.g.
|
||||
```yaml
|
||||
password-source: gopass
|
||||
password-name: jira.example.com/myuser
|
||||
password-source-path: /path/to/my-special-gopass
|
||||
```
|
||||
|
||||
This will cause go-jira to use the `gopass` style cli interaction with the `my-special-gopass` binary.
|
||||
|
||||
If you ommit the `password-source-path` option, either `gopass` (for `gopass`) or `pass` (for `pass`)
|
||||
will be used.
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
#!/bin/bash
|
||||
eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)"
|
||||
cd $(dirname $0)
|
||||
jira="../jira"
|
||||
. env.sh
|
||||
|
||||
PLAN 6
|
||||
|
||||
# reset login
|
||||
RUNS $jira logout
|
||||
RUNS $jira login
|
||||
|
||||
# cleanup from previous failed test executions
|
||||
($jira ls --project BASIC | awk -F: '{print $1}' | while read issue; do ../jira done $issue; done) | sed 's/^/# CLEANUP: /g'
|
||||
|
||||
###############################################################################
|
||||
## Create an issue
|
||||
###############################################################################
|
||||
RUNS $jira create --project BASIC -o summary=summary -o description=description --noedit --saveFile issue.props
|
||||
issue=$(awk '/issue/{print $2}' issue.props)
|
||||
|
||||
DIFF <<EOF
|
||||
OK $issue $ENDPOINT/browse/$issue
|
||||
EOF
|
||||
|
||||
# just get the number
|
||||
shortIssue=${issue#BASIC-}
|
||||
|
||||
###############################################################################
|
||||
## View the issue we just created
|
||||
###############################################################################
|
||||
|
||||
RUNS $jira view $shortIssue
|
||||
DIFF <<EOF
|
||||
issue: $issue
|
||||
created: a minute ago
|
||||
status: To Do
|
||||
summary: summary
|
||||
project: BASIC
|
||||
issuetype: Bug
|
||||
assignee: gojira
|
||||
reporter: gojira
|
||||
priority: Medium
|
||||
votes: 0
|
||||
description: |
|
||||
description
|
||||
EOF
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
#dist/github.com/Kuchenm0nster/jira-darwin-amd64 dist/github.com/Kuchenm0nster/jira-linux-amd64 dist/github.com/Kuchenm0nster/jira-windows-amd64.exe
|
||||
#dist/github.com/Kuchenm0nster/jira-linux-386 dist/github.com/Kuchenm0nster/jira-windows-386.exe
|
||||
|
||||
EXIT_CODE=0
|
||||
|
||||
function error() {
|
||||
echo $1
|
||||
EXIT_CODE=1
|
||||
}
|
||||
|
||||
DIST_DIR="dist/github.com/go-jira"
|
||||
|
||||
out=`file ${DIST_DIR}/jira-darwin-amd64 2>&1`
|
||||
if ! [[ "$out" =~ "Mach-O 64-bit" ]]; then
|
||||
error "darwin/amd64 build not as expected: $out"
|
||||
fi
|
||||
|
||||
out=`file ${DIST_DIR}/jira-linux-amd64 2>&1`
|
||||
if ! [[ "$out" =~ "ELF 64-bit LSB executable, x86-64" ]]; then
|
||||
error "linux/amd64 build not as expected: $out"
|
||||
fi
|
||||
|
||||
out=`file ${DIST_DIR}/jira-linux-386 2>&1`
|
||||
if ! [[ "$out" =~ "ELF 32-bit LSB executable, Intel 80386" ]]; then
|
||||
error "linux/i386 build not as expected: $out"
|
||||
fi
|
||||
|
||||
out=`file ${DIST_DIR}/jira-windows-amd64.exe 2>&1`
|
||||
if ! [[ "$out" =~ "PE32+ executable (console) x86-64" ]]; then
|
||||
error "windows/amd64 build not as expected: $out"
|
||||
fi
|
||||
|
||||
out=`file ${DIST_DIR}/jira-windows-386.exe 2>&1`
|
||||
if ! [[ "$out" =~ "PE32 executable (console) Intel 80386" ]]; then
|
||||
error "windows/i386 build not as expected: $out"
|
||||
fi
|
||||
|
||||
exit $EXIT_CODE
|
||||
+2
-4
@@ -1,9 +1,7 @@
|
||||
package jira
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
)
|
||||
|
||||
// https://docs.atlassian.com/jira/REST/cloud/#api/2/attachment-getAttachment
|
||||
@@ -21,7 +19,7 @@ func GetAttachment(ua HttpClient, endpoint string, id string) (*jiradata.Attachm
|
||||
|
||||
if resp.StatusCode == 200 {
|
||||
results := &jiradata.Attachment{}
|
||||
return results, json.NewDecoder(resp.Body).Decode(results)
|
||||
return results, readJSON(resp.Body, results)
|
||||
}
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
|
||||
+3
-9
@@ -3,14 +3,12 @@ package main
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"github.com/Kuchenm0nster/jira/jiracmd"
|
||||
"gopkg.in/coryb/yaml.v2"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracmd"
|
||||
"gopkg.in/op/go-logging.v1"
|
||||
)
|
||||
|
||||
@@ -29,11 +27,7 @@ func main() {
|
||||
|
||||
jiracli.InitLogging()
|
||||
|
||||
configDir := ".config/jira"
|
||||
|
||||
yaml.UseMapType(reflect.TypeOf(map[string]interface{}{}))
|
||||
defer yaml.RestoreMapType()
|
||||
|
||||
configDir := ".jira.d"
|
||||
fig := figtree.NewFigTree(
|
||||
figtree.WithHome(jiracli.Homedir()),
|
||||
figtree.WithEnvPrefix("JIRA"),
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
)
|
||||
|
||||
type ComponentProvider interface {
|
||||
@@ -31,7 +31,7 @@ func CreateComponent(ua HttpClient, endpoint string, cp ComponentProvider) (*jir
|
||||
|
||||
if resp.StatusCode == 201 {
|
||||
results := &jiradata.Component{}
|
||||
return results, json.NewDecoder(resp.Body).Decode(results)
|
||||
return results, readJSON(resp.Body, results)
|
||||
}
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
"github.com/coryb/oreo"
|
||||
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
)
|
||||
|
||||
// https://docs.atlassian.com/jira-software/REST/latest/#agile/1.0/epic-getIssuesForEpic
|
||||
@@ -53,7 +53,7 @@ func EpicSearch(ua HttpClient, endpoint string, epic string, sp SearchProvider)
|
||||
|
||||
if resp.StatusCode == 200 {
|
||||
results := &jiradata.SearchResults{}
|
||||
return results, json.NewDecoder(resp.Body).Decode(results)
|
||||
return results, readJSON(resp.Body, results)
|
||||
}
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package jira
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
)
|
||||
|
||||
func responseError(resp *http.Response) error {
|
||||
results := &jiradata.ErrorCollection{}
|
||||
if err := json.NewDecoder(resp.Body).Decode(results); err != nil {
|
||||
if err := readJSON(resp.Body, results); err != nil {
|
||||
results.Status = resp.StatusCode
|
||||
results.ErrorMessages = append(results.ErrorMessages, err.Error())
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package jira
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
)
|
||||
|
||||
// https://docs.atlassian.com/jira/REST/cloud/#api/2/field-getFields
|
||||
@@ -20,7 +18,7 @@ func GetFields(ua HttpClient, endpoint string) ([]jiradata.Field, error) {
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode == 200 {
|
||||
results := []jiradata.Field{}
|
||||
return results, json.NewDecoder(resp.Body).Decode(&results)
|
||||
return results, readJSON(resp.Body, &results)
|
||||
}
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
module github.com/Kuchenm0nster/jira
|
||||
|
||||
go 1.12
|
||||
|
||||
require (
|
||||
github.com/Masterminds/goutils v1.1.0 // indirect
|
||||
github.com/Masterminds/semver v1.5.0 // indirect
|
||||
github.com/Masterminds/sprig v2.21.0+incompatible
|
||||
github.com/Netflix/go-expect v0.0.0-20180928190340-9d1f4485533b // indirect
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc // indirect
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect
|
||||
github.com/cheekybits/genny v1.0.0 // indirect
|
||||
github.com/coryb/figtree v1.0.1-0.20190907170512-58176d03ef0d
|
||||
github.com/coryb/kingpeon v0.0.0-20180107011214-9a669f143f2e
|
||||
github.com/coryb/oreo v0.0.0-20180804211640-3e1b88fc08f1
|
||||
github.com/davecgh/go-spew v1.1.0 // indirect
|
||||
github.com/fatih/camelcase v1.0.0 // indirect
|
||||
github.com/google/uuid v1.1.1 // indirect
|
||||
github.com/guelfey/go.dbus v0.0.0-20131113121618-f6a3a2366cc3 // indirect
|
||||
github.com/hinshun/vt10x v0.0.0-20180809195222-d55458df857c // indirect
|
||||
github.com/huandu/xstrings v1.2.0 // indirect
|
||||
github.com/imdario/mergo v0.3.7 // indirect
|
||||
github.com/jinzhu/copier v0.0.0-20180308034124-7e38e58719c3
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
|
||||
github.com/kr/pretty v0.1.0 // indirect
|
||||
github.com/kr/pty v1.1.4 // indirect
|
||||
github.com/mattn/go-colorable v0.0.9 // indirect
|
||||
github.com/mattn/go-isatty v0.0.3 // indirect
|
||||
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b
|
||||
github.com/olekukonko/tablewriter v0.0.3
|
||||
github.com/pkg/browser v0.0.0-20170505125900-c90ca0c84f15
|
||||
github.com/pkg/errors v0.8.0
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/stretchr/testify v1.2.2
|
||||
github.com/theckman/go-flock v0.4.0 // indirect
|
||||
github.com/tidwall/gjson v0.0.0-20180711011033-ba784d767ac7
|
||||
github.com/tidwall/match v1.0.0 // indirect
|
||||
github.com/tmc/keyring v0.0.0-20171121202319-839169085ae1
|
||||
golang.org/x/crypto v0.0.0-20180723164146-c126467f60eb
|
||||
golang.org/x/net v0.0.0-20171102191033-01c190206fbd
|
||||
golang.org/x/sys v0.0.0-20180727230415-bd9dbc187b6e // indirect
|
||||
gopkg.in/AlecAivazis/survey.v1 v1.6.1
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
|
||||
gopkg.in/coryb/yaml.v2 v2.0.0-20180616071044-0e40e46f7153
|
||||
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473
|
||||
gopkg.in/yaml.v2 v2.2.2 // indirect
|
||||
)
|
||||
@@ -1,90 +0,0 @@
|
||||
github.com/Masterminds/goutils v1.1.0 h1:zukEsf/1JZwCMgHiK3GZftabmxiCw4apj3a28RPBiVg=
|
||||
github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
|
||||
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
|
||||
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
|
||||
github.com/Masterminds/sprig v2.21.0+incompatible h1:nPETddHHEG1ucL7H5t5T95IuWaDe5qB9ImEaztiXgRc=
|
||||
github.com/Masterminds/sprig v2.21.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=
|
||||
github.com/Netflix/go-expect v0.0.0-20180928190340-9d1f4485533b h1:sSQK05nvxs4UkgCJaxihteu+r+6ela3dNMm7NVmsS3c=
|
||||
github.com/Netflix/go-expect v0.0.0-20180928190340-9d1f4485533b/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/cheekybits/genny v1.0.0 h1:uGGa4nei+j20rOSeDeP5Of12XVm7TGUd4dJA9RDitfE=
|
||||
github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ=
|
||||
github.com/coryb/figtree v1.0.1-0.20190907170512-58176d03ef0d h1:99xxg8FYj+5TYg88DxA4xL8ODuI6OvuSu35WQOVPDPg=
|
||||
github.com/coryb/figtree v1.0.1-0.20190907170512-58176d03ef0d/go.mod h1:uAkZUEGm6dROpxfy+8vXLs7JrLCI4O+gQyKAuISxI/g=
|
||||
github.com/coryb/kingpeon v0.0.0-20180107011214-9a669f143f2e h1:tGmk9Tuyz7fKuBq/d3nFJvVWRvc48MEBKQC4uYV3wb0=
|
||||
github.com/coryb/kingpeon v0.0.0-20180107011214-9a669f143f2e/go.mod h1:gBc0uEH6swbOMoR7VkVuW7w5fGvZu/KHeSgxBR4Ta7Q=
|
||||
github.com/coryb/oreo v0.0.0-20180804211640-3e1b88fc08f1 h1:Hh0qSvmvoAGL8VxvEoUv9UuUf9XlKcQtSxAMTz1kqfE=
|
||||
github.com/coryb/oreo v0.0.0-20180804211640-3e1b88fc08f1/go.mod h1:l/wuS2rM8ostk0aApWje8tsZNWJPOc2TVr85B0n3e6M=
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/fatih/camelcase v1.0.0 h1:hxNvNX/xYBp0ovncs8WyWZrOrpBNub/JfaMvbURyft8=
|
||||
github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc=
|
||||
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/guelfey/go.dbus v0.0.0-20131113121618-f6a3a2366cc3 h1:fngCxKbvZdctIsWj2hYijhAt4iK0JXSSA78B36xP0yI=
|
||||
github.com/guelfey/go.dbus v0.0.0-20131113121618-f6a3a2366cc3/go.mod h1:0CNX5Cvi77WEH8llpfZ/ieuqyceb1cnO5//b5zzsnF8=
|
||||
github.com/hinshun/vt10x v0.0.0-20180809195222-d55458df857c h1:kp3AxgXgDOmIJFR7bIwqFhwJ2qWar8tEQSE5XXhCfVk=
|
||||
github.com/hinshun/vt10x v0.0.0-20180809195222-d55458df857c/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A=
|
||||
github.com/huandu/xstrings v1.2.0 h1:yPeWdRnmynF7p+lLYz0H2tthW9lqhMJrQV/U7yy4wX0=
|
||||
github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4=
|
||||
github.com/imdario/mergo v0.3.7 h1:Y+UAYTZ7gDEuOfhxKWy+dvb5dRQ6rJjFSdX2HZY1/gI=
|
||||
github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||
github.com/jinzhu/copier v0.0.0-20180308034124-7e38e58719c3 h1:sHsPfNMAG70QAvKbddQ0uScZCHQoZsT5NykGRCeeeIs=
|
||||
github.com/jinzhu/copier v0.0.0-20180308034124-7e38e58719c3/go.mod h1:yL958EeXv8Ylng6IfnvG4oflryUi3vgA3xPs9hmII1s=
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
|
||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/pty v1.1.4 h1:5Myjjh3JY/NaAi4IsUbHADytDyl1VE1Y9PXDlL+P/VQ=
|
||||
github.com/kr/pty v1.1.4/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=
|
||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
github.com/mattn/go-isatty v0.0.3 h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI=
|
||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
github.com/mattn/go-runewidth v0.0.6 h1:V2iyH+aX9C5fsYCpK60U8BYIvmhqxuOL3JZcqc1NB7k=
|
||||
github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4=
|
||||
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
|
||||
github.com/olekukonko/tablewriter v0.0.3 h1:i0LBnzgiChAWHJYTQAZJDOgf8MNxAVYZJ2m63SIDimI=
|
||||
github.com/olekukonko/tablewriter v0.0.3/go.mod h1:YZeBtGzYYEsCHp2LST/u/0NDwGkRoBtmn1cIWCJiS6M=
|
||||
github.com/pkg/browser v0.0.0-20170505125900-c90ca0c84f15 h1:mrI+6Ae64Wjt+uahGe5we/sPS1sXjvfT3YjtawAVgps=
|
||||
github.com/pkg/browser v0.0.0-20170505125900-c90ca0c84f15/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA=
|
||||
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/theckman/go-flock v0.4.0 h1:bcqNkS4RTQBGWybG7IBimUMxnLz53Qes1+D4QaOhzJc=
|
||||
github.com/theckman/go-flock v0.4.0/go.mod h1:kjuth3y9VJ2aNlkNEO99G/8lp9fMIKaGyBmh84IBheM=
|
||||
github.com/tidwall/gjson v0.0.0-20180711011033-ba784d767ac7 h1:PW7TzL8BOpYMcUYSv4qWDoH1Y5iRzVABteynvfF7pwE=
|
||||
github.com/tidwall/gjson v0.0.0-20180711011033-ba784d767ac7/go.mod h1:c/nTNbUr0E0OrXEhq1pwa8iEgc2DOt4ZZqAt1HtCkPA=
|
||||
github.com/tidwall/match v1.0.0 h1:Ym1EcFkp+UQ4ptxfWlW+iMdq5cPH5nEuGzdf/Pb7VmI=
|
||||
github.com/tidwall/match v1.0.0/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E=
|
||||
github.com/tmc/keyring v0.0.0-20171121202319-839169085ae1 h1:+gXfyhy0t28Guz+vFztBg45yIquB2bNtiFvbItzJtUc=
|
||||
github.com/tmc/keyring v0.0.0-20171121202319-839169085ae1/go.mod h1:gsa3jftQ3xia55nzIN4lXLYzDcWdxjojdKoz+N0St2Y=
|
||||
golang.org/x/crypto v0.0.0-20180723164146-c126467f60eb h1:Ah9YqXLj6fEgeKqcmBuLCbAsrF3ScD7dJ/bYM0C6tXI=
|
||||
golang.org/x/crypto v0.0.0-20180723164146-c126467f60eb/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/net v0.0.0-20171102191033-01c190206fbd h1:CLQSRrSDQMOMkogMxky7XOkERftMegAnxjT2re4E66M=
|
||||
golang.org/x/net v0.0.0-20171102191033-01c190206fbd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/sys v0.0.0-20180727230415-bd9dbc187b6e h1:3dQ4fR8k5KugjVKO0oqSd1odxuk2yaE2CIfxWP2WarQ=
|
||||
golang.org/x/sys v0.0.0-20180727230415-bd9dbc187b6e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
gopkg.in/AlecAivazis/survey.v1 v1.6.1 h1:HyWkjKGBpzhNxrpaKRLDqoa4L1f4cMVBNU4bnVmU8Mw=
|
||||
gopkg.in/AlecAivazis/survey.v1 v1.6.1/go.mod h1:2Ehl7OqkBl3Xb8VmC4oFW2bItAhnUfzIjrOzwRxCrOU=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/coryb/yaml.v2 v2.0.0-20180616071044-0e40e46f7153 h1:3KfEubBNUdXqlEXuMz13dXy4cYK2AvuPhp8fKTYuPdU=
|
||||
gopkg.in/coryb/yaml.v2 v2.0.0-20180616071044-0e40e46f7153/go.mod h1:Vth2iKfSejHZ3p6akgWO0iSjuuiu6mNCEgzcYUCnumw=
|
||||
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473 h1:6D+BvnJ/j6e222UW8s2qTSe3wGBtvo0MbVQG/c5k8RE=
|
||||
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473/go.mod h1:N1eN2tsCx0Ydtgjl4cqmbRCsY4/+z4cYDeqwZTk6zog=
|
||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
"github.com/coryb/oreo"
|
||||
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
)
|
||||
|
||||
type IssueQueryProvider interface {
|
||||
@@ -69,7 +69,7 @@ func GetIssue(ua HttpClient, endpoint string, issue string, iqg IssueQueryProvid
|
||||
|
||||
if resp.StatusCode == 200 {
|
||||
results := &jiradata.Issue{}
|
||||
return results, json.NewDecoder(resp.Body).Decode(results)
|
||||
return results, readJSON(resp.Body, results)
|
||||
}
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
@@ -95,13 +95,15 @@ func GetIssueWorklog(ua HttpClient, endpoint string, issue string) (*jiradata.Wo
|
||||
|
||||
if resp.StatusCode == 200 {
|
||||
results := &jiradata.WorklogWithPagination{}
|
||||
err := json.NewDecoder(resp.Body).Decode(results)
|
||||
err := readJSON(resp.Body, results)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
startAt = startAt + maxResults
|
||||
total = results.Total
|
||||
worklogs = append(worklogs, results.Worklogs...)
|
||||
for _, worklog := range results.Worklogs {
|
||||
worklogs = append(worklogs, worklog)
|
||||
}
|
||||
} else {
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
@@ -133,7 +135,7 @@ func AddIssueWorklog(ua HttpClient, endpoint string, issue string, wp WorklogPro
|
||||
|
||||
if resp.StatusCode == 201 {
|
||||
results := &jiradata.Worklog{}
|
||||
return results, json.NewDecoder(resp.Body).Decode(results)
|
||||
return results, readJSON(resp.Body, results)
|
||||
}
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
@@ -153,7 +155,7 @@ func GetIssueEditMeta(ua HttpClient, endpoint string, issue string) (*jiradata.E
|
||||
|
||||
if resp.StatusCode == 200 {
|
||||
results := &jiradata.EditMeta{}
|
||||
return results, json.NewDecoder(resp.Body).Decode(results)
|
||||
return results, readJSON(resp.Body, results)
|
||||
}
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
@@ -206,7 +208,7 @@ func CreateIssue(ua HttpClient, endpoint string, iup IssueUpdateProvider) (*jira
|
||||
|
||||
if resp.StatusCode == 201 {
|
||||
results := &jiradata.IssueCreateResponse{}
|
||||
return results, json.NewDecoder(resp.Body).Decode(results)
|
||||
return results, readJSON(resp.Body, results)
|
||||
}
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
@@ -227,7 +229,7 @@ func GetIssueCreateMetaProject(ua HttpClient, endpoint string, projectKey string
|
||||
|
||||
if resp.StatusCode == 200 {
|
||||
results := &jiradata.CreateMeta{}
|
||||
err = json.NewDecoder(resp.Body).Decode(results)
|
||||
err = readJSON(resp.Body, results)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -236,7 +238,7 @@ func GetIssueCreateMetaProject(ua HttpClient, endpoint string, projectKey string
|
||||
return project, nil
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("project %s not found", projectKey)
|
||||
return nil, fmt.Errorf("Project %s not found", projectKey)
|
||||
}
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
@@ -255,24 +257,24 @@ func GetIssueCreateMetaIssueType(ua HttpClient, endpoint string, projectKey, iss
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
results := &jiradata.CreateMeta{}
|
||||
if err := json.NewDecoder(resp.Body).Decode(results); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, project := range results.Projects {
|
||||
if project.Key != projectKey {
|
||||
continue
|
||||
if resp.StatusCode == 200 {
|
||||
results := &jiradata.CreateMeta{}
|
||||
err = readJSON(resp.Body, results)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, issueType := range project.IssueTypes {
|
||||
if issueType.Name == issueTypeName {
|
||||
return issueType, nil
|
||||
for _, project := range results.Projects {
|
||||
if project.Key == projectKey {
|
||||
for _, issueType := range project.IssueTypes {
|
||||
if issueType.Name == issueTypeName {
|
||||
return issueType, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("Project %s and IssueType %s not found", projectKey, issueTypeName)
|
||||
}
|
||||
return nil, fmt.Errorf("project %s and IssueType %s not found", projectKey, issueTypeName)
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
|
||||
type LinkIssueProvider interface {
|
||||
@@ -319,7 +321,7 @@ func GetIssueTransitions(ua HttpClient, endpoint string, issue string) (*jiradat
|
||||
|
||||
if resp.StatusCode == 200 {
|
||||
results := &jiradata.TransitionsMeta{}
|
||||
return results, json.NewDecoder(resp.Body).Decode(results)
|
||||
return results, readJSON(resp.Body, results)
|
||||
}
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
@@ -367,7 +369,7 @@ func GetIssueLinkTypes(ua HttpClient, endpoint string) (*jiradata.IssueLinkTypes
|
||||
}{
|
||||
IssueLinkTypes: jiradata.IssueLinkTypes{},
|
||||
}
|
||||
return &results.IssueLinkTypes, json.NewDecoder(resp.Body).Decode(&results)
|
||||
return &results.IssueLinkTypes, readJSON(resp.Body, &results)
|
||||
}
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
@@ -501,7 +503,7 @@ func IssueAddComment(ua HttpClient, endpoint string, issue string, cp CommentPro
|
||||
|
||||
if resp.StatusCode == 201 {
|
||||
results := jiradata.Comment{}
|
||||
return &results, json.NewDecoder(resp.Body).Decode(&results)
|
||||
return &results, readJSON(resp.Body, &results)
|
||||
}
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
@@ -561,9 +563,6 @@ func IssueAttachFile(ua HttpClient, endpoint string, issue, filename string, con
|
||||
}
|
||||
|
||||
uri, err := url.Parse(URLJoin(endpoint, "rest/api/2/issue", issue, "attachments"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req := oreo.RequestBuilder(uri).WithMethod("POST").WithHeader(
|
||||
"X-Atlassian-Token", "no-check",
|
||||
).WithHeader(
|
||||
@@ -579,7 +578,7 @@ func IssueAttachFile(ua HttpClient, endpoint string, issue, filename string, con
|
||||
|
||||
if resp.StatusCode == 200 {
|
||||
results := jiradata.ListOfAttachment{}
|
||||
return &results, json.NewDecoder(resp.Body).Decode(&results)
|
||||
return &results, readJSON(resp.Body, &results)
|
||||
}
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
|
||||
@@ -2,9 +2,12 @@ package jira
|
||||
|
||||
import (
|
||||
"github.com/coryb/oreo"
|
||||
logging "gopkg.in/op/go-logging.v1"
|
||||
)
|
||||
|
||||
const VERSION = "1.0.22"
|
||||
var log = logging.MustGetLogger("jira")
|
||||
|
||||
const VERSION = "1.0.20"
|
||||
|
||||
type Jira struct {
|
||||
Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
|
||||
|
||||
+68
-103
@@ -12,7 +12,6 @@ import (
|
||||
"os/exec"
|
||||
"reflect"
|
||||
"runtime/debug"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/coryb/figtree"
|
||||
@@ -72,12 +71,6 @@ type GlobalOptions struct {
|
||||
// location using the `pass` tool, if missing prompt the user and store in the PasswordDirectory
|
||||
PasswordSource figtree.StringOption `yaml:"password-source,omitempty" json:"password-source,omitempty"`
|
||||
|
||||
// PasswordSourcePath can be used to specify the path to the PasswordSource binary to use.
|
||||
PasswordSourcePath figtree.StringOption `yaml:"password-source-path,omitempty" json:"password-source-path,omitempty"`
|
||||
|
||||
// Cached password to avoid invoking password source on each API request
|
||||
cachedPassword string
|
||||
|
||||
// PasswordDirectory is only used for the "pass" PasswordSource. It is the location for the encrypted password
|
||||
// files used by `pass`. Effectively this overrides the "PASSWORD_STORE_DIR" environment variable
|
||||
PasswordDirectory figtree.StringOption `yaml:"password-directory,omitempty" json:"password-directory,omitempty"`
|
||||
@@ -157,39 +150,43 @@ func register(app *kingpin.Application, o *oreo.Client, fig *figtree.FigTree) {
|
||||
app.Flag("user", "user name used within the Jira service").Short('u').SetValue(&globals.User)
|
||||
app.Flag("login", "login name that corresponds to the user used for authentication").SetValue(&globals.Login)
|
||||
|
||||
o = o.WithPreCallback(func(req *http.Request) (*http.Request, error) {
|
||||
if globals.AuthMethod() == "api-token" {
|
||||
// need to set basic auth header with user@domain:api-token
|
||||
token := globals.GetPass()
|
||||
authHeader := fmt.Sprintf("Basic %s", base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", globals.Login.Value, token))))
|
||||
req.Header.Add("Authorization", authHeader)
|
||||
}
|
||||
return req, nil
|
||||
})
|
||||
o = o.WithPreCallback(
|
||||
func(req *http.Request) (*http.Request, error) {
|
||||
if globals.AuthMethod() == "api-token" {
|
||||
// need to set basic auth header with user@domain:api-token
|
||||
token := globals.GetPass()
|
||||
authHeader := fmt.Sprintf("Basic %s", base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", globals.Login.Value, token))))
|
||||
req.Header.Add("Authorization", authHeader)
|
||||
}
|
||||
return req, nil
|
||||
},
|
||||
)
|
||||
|
||||
o = o.WithPostCallback(func(req *http.Request, resp *http.Response) (*http.Response, error) {
|
||||
if globals.AuthMethod() == "session" {
|
||||
authUser := resp.Header.Get("X-Ausername")
|
||||
if authUser == "" || authUser == "anonymous" {
|
||||
// preserve the --quiet value, we need to temporarily disable it so
|
||||
// the normal login output is surpressed
|
||||
defer func(quiet bool) {
|
||||
globals.Quiet.Value = quiet
|
||||
}(globals.Quiet.Value)
|
||||
globals.Quiet.Value = true
|
||||
o = o.WithPostCallback(
|
||||
func(req *http.Request, resp *http.Response) (*http.Response, error) {
|
||||
if globals.AuthMethod() == "session" {
|
||||
authUser := resp.Header.Get("X-Ausername")
|
||||
if authUser == "" || authUser == "anonymous" {
|
||||
// preserve the --quiet value, we need to temporarily disable it so
|
||||
// the normal login output is surpressed
|
||||
defer func(quiet bool) {
|
||||
globals.Quiet.Value = quiet
|
||||
}(globals.Quiet.Value)
|
||||
globals.Quiet.Value = true
|
||||
|
||||
// we are not logged in, so force login now by running the "login" command
|
||||
app.Parse([]string{"login"})
|
||||
// we are not logged in, so force login now by running the "login" command
|
||||
app.Parse([]string{"login"})
|
||||
|
||||
// rerun the original request
|
||||
// rerun the original request
|
||||
return o.Do(req)
|
||||
}
|
||||
} else if globals.AuthMethod() == "api-token" && resp.StatusCode == 401 {
|
||||
globals.SetPass("")
|
||||
return o.Do(req)
|
||||
}
|
||||
} else if globals.AuthMethod() == "api-token" && resp.StatusCode == 401 {
|
||||
globals.SetPass("")
|
||||
return o.Do(req)
|
||||
}
|
||||
return resp, nil
|
||||
})
|
||||
return resp, nil
|
||||
},
|
||||
)
|
||||
|
||||
for _, command := range globalCommandRegistry {
|
||||
copy := command
|
||||
@@ -241,12 +238,14 @@ func register(app *kingpin.Application, o *oreo.Client, fig *figtree.FigTree) {
|
||||
copy.Entry.UsageFunc(fig, cmd)
|
||||
}
|
||||
|
||||
cmd.Action(func(_ *kingpin.ParseContext) error {
|
||||
if logging.GetLevel("") > logging.DEBUG {
|
||||
o = o.WithTrace(true)
|
||||
}
|
||||
return copy.Entry.ExecuteFunc(o, &globals)
|
||||
})
|
||||
cmd.Action(
|
||||
func(_ *kingpin.ParseContext) error {
|
||||
if logging.GetLevel("") > logging.DEBUG {
|
||||
o = o.WithTrace(true)
|
||||
}
|
||||
return copy.Entry.ExecuteFunc(o, &globals)
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,45 +321,38 @@ func (o *CommonOptions) editFile(fileName string) (changes bool, err error) {
|
||||
}
|
||||
|
||||
// now we just need to diff the files to see if there are any changes
|
||||
f1, err := os.Open(tmpFileNameOrig)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
f2, err := os.Open(fileName)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
stat1, err := f1.Stat()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
stat2, err := f2.Stat()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
// different sizes, so must have changes
|
||||
if stat1.Size() != stat2.Size() {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
p1, p2 := make([]byte, 1024), make([]byte, 1024)
|
||||
var n1, n2 int
|
||||
// loop though 1024 bytes at a time comparing the buffers for changes
|
||||
for err != io.EOF {
|
||||
n1, _ = f1.Read(p1)
|
||||
n2, err = f2.Read(p2)
|
||||
if n1 != n2 {
|
||||
return true, nil
|
||||
}
|
||||
if !bytes.Equal(p1[:n1], p2[:n2]) {
|
||||
return true, nil
|
||||
var oldHandle, newHandle *os.File
|
||||
var oldStat, newStat os.FileInfo
|
||||
if oldHandle, err = os.Open(tmpFileNameOrig); err == nil {
|
||||
if newHandle, err = os.Open(fileName); err == nil {
|
||||
if oldStat, err = oldHandle.Stat(); err == nil {
|
||||
if newStat, err = newHandle.Stat(); err == nil {
|
||||
// different sizes, so must have changes
|
||||
if oldStat.Size() != newStat.Size() {
|
||||
return true, err
|
||||
}
|
||||
oldBuf, newBuf := make([]byte, 1024), make([]byte, 1024)
|
||||
var oldCount, newCount int
|
||||
// loop though 1024 bytes at a time comparing the buffers for changes
|
||||
for err != io.EOF {
|
||||
oldCount, _ = oldHandle.Read(oldBuf)
|
||||
newCount, err = newHandle.Read(newBuf)
|
||||
if oldCount != newCount {
|
||||
return true, nil
|
||||
}
|
||||
if bytes.Compare(oldBuf[:oldCount], newBuf[:newCount]) != 0 {
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false, nil
|
||||
return false, err
|
||||
}
|
||||
|
||||
var EditLoopAbort = fmt.Errorf("edit Loop aborted by request")
|
||||
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)
|
||||
@@ -465,30 +457,3 @@ func EditLoop(opts *CommonOptions, input interface{}, output interface{}, submit
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func FormatIssue(issueKey string, project string) string {
|
||||
if issueKey == "" {
|
||||
return ""
|
||||
}
|
||||
|
||||
// expect PROJ-1234 issue format, this will split and
|
||||
// reassemble, converting proj-1234 to PROJ-1234
|
||||
parts := strings.SplitN(issueKey, "-", 2)
|
||||
if len(parts) > 1 {
|
||||
return fmt.Sprintf("%s-%s", strings.ToUpper(parts[0]), parts[1])
|
||||
}
|
||||
|
||||
// if issue is not PROJ-1234 then it might just be 1234, so verify
|
||||
// it is a number here otherwise warn and return input
|
||||
if _, err := strconv.Atoi(issueKey); err != nil {
|
||||
log.Warningf("Unexpected issue format %q, expected PROJ-1234", issueKey)
|
||||
return issueKey
|
||||
}
|
||||
|
||||
if project == "" {
|
||||
log.Warningf("Using abbreviated issue %q but `project` property is not defined", issueKey)
|
||||
return issueKey
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s-%s", strings.ToUpper(project), issueKey)
|
||||
}
|
||||
|
||||
+28
-118
@@ -3,13 +3,12 @@ package jiracli
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/AlecAivazis/survey.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
)
|
||||
|
||||
func (o *GlobalOptions) ProvideAuthParams() *jiradata.AuthParams {
|
||||
@@ -31,110 +30,44 @@ func (o *GlobalOptions) keyName() string {
|
||||
}
|
||||
return fmt.Sprintf("GoJira/%s", user)
|
||||
}
|
||||
|
||||
if o.PasswordSource.Value == "gopass" {
|
||||
if o.PasswordName.Value != "" {
|
||||
return o.PasswordName.Value
|
||||
}
|
||||
return fmt.Sprintf("GoJira/%s", user)
|
||||
}
|
||||
return user
|
||||
}
|
||||
|
||||
func (o *GlobalOptions) GetPasswordPath() string {
|
||||
// if no password source path then just default
|
||||
// to the password source name
|
||||
if o.PasswordSourcePath.Value == "" {
|
||||
return o.PasswordSource.Value
|
||||
}
|
||||
return o.PasswordSourcePath.Value
|
||||
}
|
||||
|
||||
func (o *GlobalOptions) GetPass() string {
|
||||
if o.cachedPassword != "" {
|
||||
return o.cachedPassword
|
||||
}
|
||||
log.Debugf("Getting Password")
|
||||
passwd := ""
|
||||
if o.PasswordSource.Value != "" {
|
||||
log.Debugf("password-source: %s", o.PasswordSource)
|
||||
if o.PasswordSource.Value == "keyring" {
|
||||
log.Info("Querying keyring password source.")
|
||||
var err error
|
||||
o.cachedPassword, err = keyringGet(o.keyName())
|
||||
passwd, err = keyringGet(o.keyName())
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
} else if o.PasswordSource.Value == "gopass" {
|
||||
log.Debugf("Querying gopass password source.")
|
||||
binary := o.GetPasswordPath()
|
||||
if o.PasswordDirectory.Value != "" {
|
||||
orig := os.Getenv("PASSWORD_STORE_DIR")
|
||||
log.Debugf("using password-directory: %s", o.PasswordDirectory)
|
||||
os.Setenv("PASSWORD_STORE_DIR", o.PasswordDirectory.Value)
|
||||
defer os.Setenv("PASSWORD_STORE_DIR", orig)
|
||||
}
|
||||
if passDir := os.Getenv("PASSWORD_STORE_DIR"); passDir != "" {
|
||||
log.Debugf("using PASSWORD_STORE_DIR=%s", passDir)
|
||||
}
|
||||
if bin, err := exec.LookPath(binary); err == nil {
|
||||
log.Debugf("found gopass at: %s", bin)
|
||||
buf := bytes.NewBufferString("")
|
||||
cmd := exec.Command(bin, "show", "-o", o.keyName())
|
||||
cmd.Stdout = buf
|
||||
cmd.Stderr = os.Stderr
|
||||
if err := cmd.Run(); err == nil {
|
||||
o.cachedPassword = strings.TrimSpace(buf.String())
|
||||
} else {
|
||||
log.Warningf("gopass command failed with:\n%s", buf.String())
|
||||
}
|
||||
} else {
|
||||
log.Warning("Gopass binary was not found! Fallback to default password behaviour!")
|
||||
}
|
||||
} else if o.PasswordSource.Value == "pass" {
|
||||
log.Debugf("Querying pass password source.")
|
||||
binary := o.GetPasswordPath()
|
||||
if o.PasswordDirectory.Value != "" {
|
||||
orig := os.Getenv("PASSWORD_STORE_DIR")
|
||||
log.Debugf("using password-directory: %s", o.PasswordDirectory)
|
||||
os.Setenv("PASSWORD_STORE_DIR", o.PasswordDirectory.Value)
|
||||
defer os.Setenv("PASSWORD_STORE_DIR", orig)
|
||||
}
|
||||
if passDir := os.Getenv("PASSWORD_STORE_DIR"); passDir != "" {
|
||||
log.Debugf("using PASSWORD_STORE_DIR=%s", passDir)
|
||||
}
|
||||
if bin, err := exec.LookPath(binary); err == nil {
|
||||
log.Debugf("found pass at: %s", bin)
|
||||
if bin, err := exec.LookPath("pass"); err == nil {
|
||||
buf := bytes.NewBufferString("")
|
||||
cmd := exec.Command(bin, o.keyName())
|
||||
cmd.Stdout = buf
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.Stderr = buf
|
||||
if err := cmd.Run(); err == nil {
|
||||
o.cachedPassword = strings.TrimSpace(buf.String())
|
||||
} else {
|
||||
log.Warningf("pass command failed with:\n%s", buf.String())
|
||||
passwd = strings.TrimSpace(buf.String())
|
||||
}
|
||||
} else {
|
||||
log.Warning("pass binary was not found! Fallback to default password behaviour!")
|
||||
}
|
||||
} else if o.PasswordSource.Value == "stdin" {
|
||||
log.Info("Reading password from stdin.")
|
||||
allBytes, err := ioutil.ReadAll(os.Stdin)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("unable to read bytes from stdin: %s", err))
|
||||
}
|
||||
o.cachedPassword = string(allBytes)
|
||||
} else {
|
||||
log.Warningf("Unknown password-source: %s", o.PasswordSource)
|
||||
}
|
||||
}
|
||||
|
||||
if o.cachedPassword != "" {
|
||||
log.Info("Password cached.")
|
||||
return o.cachedPassword
|
||||
if passwd != "" {
|
||||
return passwd
|
||||
}
|
||||
|
||||
if o.cachedPassword = os.Getenv("JIRA_API_TOKEN"); o.cachedPassword != "" && o.AuthMethod() == "api-token" {
|
||||
return o.cachedPassword
|
||||
if passwd = os.Getenv("JIRA_API_TOKEN"); passwd != "" && o.AuthMethod() == "api-token" {
|
||||
return passwd
|
||||
}
|
||||
|
||||
prompt := fmt.Sprintf("Jira Password [%s]: ", o.Login)
|
||||
@@ -150,23 +83,18 @@ func (o *GlobalOptions) GetPass() string {
|
||||
Message: prompt,
|
||||
Help: help,
|
||||
},
|
||||
&o.cachedPassword,
|
||||
&passwd,
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
log.Errorf("%s", err)
|
||||
panic(Exit{Code: 1})
|
||||
}
|
||||
o.SetPass(o.cachedPassword)
|
||||
return o.cachedPassword
|
||||
o.SetPass(passwd)
|
||||
return passwd
|
||||
}
|
||||
|
||||
func (o *GlobalOptions) SetPass(passwd string) error {
|
||||
// dont reset password to empty string
|
||||
if passwd == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
if o.PasswordSource.Value == "keyring" {
|
||||
// save password in keychain so that it can be used for subsequent http requests
|
||||
err := keyringSet(o.keyName(), passwd)
|
||||
@@ -174,29 +102,6 @@ func (o *GlobalOptions) SetPass(passwd string) error {
|
||||
log.Errorf("Failed to set password in keyring: %s", err)
|
||||
return err
|
||||
}
|
||||
} else if o.PasswordSource.Value == "gopass" {
|
||||
if o.PasswordDirectory.Value != "" {
|
||||
orig := os.Getenv("PASSWORD_STORE_DIR")
|
||||
os.Setenv("PASSWORD_STORE_DIR", o.PasswordDirectory.Value)
|
||||
defer os.Setenv("PASSWORD_STORE_DIR", orig)
|
||||
}
|
||||
if bin, err := exec.LookPath("gopass"); err == nil {
|
||||
log.Debugf("using %s", bin)
|
||||
passName := o.keyName()
|
||||
if passwd != "" {
|
||||
in := bytes.NewBufferString(fmt.Sprintf("%s\n", passwd))
|
||||
out := bytes.NewBufferString("")
|
||||
cmd := exec.Command(bin, "insert", "--force", passName)
|
||||
cmd.Stdin = in
|
||||
cmd.Stdout = out
|
||||
cmd.Stderr = out
|
||||
if err := cmd.Run(); err != nil {
|
||||
return fmt.Errorf("Failed to insert password: %s", out.String())
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("Gopass binary not found!")
|
||||
}
|
||||
} else if o.PasswordSource.Value == "pass" {
|
||||
if o.PasswordDirectory.Value != "" {
|
||||
orig := os.Getenv("PASSWORD_STORE_DIR")
|
||||
@@ -206,17 +111,22 @@ func (o *GlobalOptions) SetPass(passwd string) error {
|
||||
if bin, err := exec.LookPath("pass"); err == nil {
|
||||
log.Debugf("using %s", bin)
|
||||
passName := o.keyName()
|
||||
in := bytes.NewBufferString(fmt.Sprintf("%s\n%s\n", passwd, passwd))
|
||||
out := bytes.NewBufferString("")
|
||||
cmd := exec.Command(bin, "insert", "--force", passName)
|
||||
cmd.Stdin = in
|
||||
cmd.Stdout = out
|
||||
cmd.Stderr = out
|
||||
if err := cmd.Run(); err != nil {
|
||||
return fmt.Errorf("Failed to insert password: %s", out.String())
|
||||
if passwd != "" {
|
||||
in := bytes.NewBufferString(fmt.Sprintf("%s\n%s\n", passwd, passwd))
|
||||
out := bytes.NewBufferString("")
|
||||
cmd := exec.Command(bin, "insert", "--force", passName)
|
||||
cmd.Stdin = in
|
||||
cmd.Stdout = out
|
||||
cmd.Stderr = out
|
||||
if err := cmd.Run(); err != nil {
|
||||
return fmt.Errorf("Failed to insert password: %s", out.String())
|
||||
}
|
||||
} else {
|
||||
// clear the `pass` entry on empty password
|
||||
if err := exec.Command(bin, "rm", "--force", passName).Run(); err != nil {
|
||||
return fmt.Errorf("Failed to clear password for %s", passName)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("Pass binary not found!")
|
||||
}
|
||||
} else if o.PasswordSource.Value != "" {
|
||||
return fmt.Errorf("Unknown password-source: %s", o.PasswordSource)
|
||||
|
||||
+25
-83
@@ -16,11 +16,9 @@ import (
|
||||
|
||||
yaml "gopkg.in/coryb/yaml.v2"
|
||||
|
||||
"github.com/Masterminds/sprig"
|
||||
"github.com/coryb/figtree"
|
||||
shellquote "github.com/kballard/go-shellquote"
|
||||
"github.com/mgutz/ansi"
|
||||
"github.com/olekukonko/tablewriter"
|
||||
"golang.org/x/crypto/ssh/terminal"
|
||||
)
|
||||
|
||||
@@ -36,8 +34,8 @@ func findTemplate(name string) ([]byte, error) {
|
||||
}
|
||||
|
||||
func getTemplate(name string) (string, error) {
|
||||
if _, err := os.Stat(".jira.d/" + name); err == nil {
|
||||
b, err := ioutil.ReadFile(".jira.d/" + name)
|
||||
if _, err := os.Stat(name); err == nil {
|
||||
b, err := ioutil.ReadFile(name)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -46,8 +44,7 @@ func getTemplate(name string) (string, error) {
|
||||
b, err := findTemplate(name)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if b != nil {
|
||||
} else if b != nil {
|
||||
return string(b), nil
|
||||
}
|
||||
if s, ok := AllTemplates[name]; ok {
|
||||
@@ -78,9 +75,6 @@ func TemplateProcessor() *template.Template {
|
||||
}
|
||||
return out
|
||||
},
|
||||
"fit": func(size int, content string) string {
|
||||
return fmt.Sprintf(fmt.Sprintf("%%-%d.%ds", size, size), content)
|
||||
},
|
||||
"shellquote": func(content string) string {
|
||||
return shellquote.Join(content)
|
||||
},
|
||||
@@ -111,9 +105,6 @@ func TemplateProcessor() *template.Template {
|
||||
}
|
||||
return 120
|
||||
},
|
||||
"pctOf": func(size, percent int) int {
|
||||
return int(float32(size) * (float32(percent) / 100))
|
||||
},
|
||||
"sub": func(a, b int) int {
|
||||
return a - b
|
||||
},
|
||||
@@ -128,7 +119,7 @@ func TemplateProcessor() *template.Template {
|
||||
}
|
||||
},
|
||||
"indent": func(spaces int, content string) string {
|
||||
indent := make([]rune, spaces+1)
|
||||
indent := make([]rune, spaces+1, spaces+1)
|
||||
indent[0] = '\n'
|
||||
for i := 1; i < spaces+1; i++ {
|
||||
indent[i] = ' '
|
||||
@@ -152,9 +143,6 @@ func TemplateProcessor() *template.Template {
|
||||
"color": func(color string) string {
|
||||
return ansi.ColorCode(color)
|
||||
},
|
||||
"remLineBreak": func(content string) string {
|
||||
return strings.Replace(strings.Replace(content, string('\r'), string(' '), -1), string('\n'), string(' '), -1)
|
||||
},
|
||||
"regReplace": func(search string, replace string, content string) string {
|
||||
re := regexp.MustCompile(search)
|
||||
return re.ReplaceAllString(content, replace)
|
||||
@@ -192,7 +180,7 @@ func TemplateProcessor() *template.Template {
|
||||
return dateFormat(format, content)
|
||||
},
|
||||
}
|
||||
return template.New("gojira").Funcs(sprig.GenericFuncMap()).Funcs(funcs)
|
||||
return template.New("gojira").Funcs(funcs)
|
||||
}
|
||||
|
||||
func ConfigTemplate(fig *figtree.FigTree, template, command string, opts interface{}) (string, error) {
|
||||
@@ -254,40 +242,13 @@ func RunTemplate(templateName string, data interface{}, out io.Writer) error {
|
||||
return err
|
||||
}
|
||||
|
||||
table := tablewriter.NewWriter(out)
|
||||
table.SetAutoFormatHeaders(false)
|
||||
headers := []string{}
|
||||
cells := [][]string{}
|
||||
tmpl, err := TemplateProcessor().Funcs(map[string]interface{}{
|
||||
"headers": func(titles ...string) string {
|
||||
headers = append(headers, titles...)
|
||||
return ""
|
||||
},
|
||||
"row": func() string {
|
||||
cells = append(cells, []string{})
|
||||
return ""
|
||||
},
|
||||
"cell": func(value interface{}) (string, error) {
|
||||
if len(cells) == 0 {
|
||||
return "", fmt.Errorf(`"cell" template function called before "row" template function`)
|
||||
}
|
||||
cells[len(cells)-1] = append(cells[len(cells)-1], fmt.Sprintf("%v", value))
|
||||
return "", nil
|
||||
},
|
||||
}).Parse(templateContent)
|
||||
tmpl, err := TemplateProcessor().Parse(templateContent)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := tmpl.Execute(out, rawData); err != nil {
|
||||
return err
|
||||
}
|
||||
if len(headers) > 0 || len(cells) > 0 {
|
||||
table.SetHeader(headers)
|
||||
table.AppendBulk(cells)
|
||||
table.Render()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -324,42 +285,23 @@ const defaultDebugTemplate = "{{ . | toJson}}\n"
|
||||
const defaultListTemplate = "{{ range .issues }}{{ .key | append \":\" | printf \"%-12s\"}} {{ .fields.summary }}\n{{ end }}"
|
||||
|
||||
const defaultTableTemplate = `{{/* table template */ -}}
|
||||
{{- headers "Issue" "Summary" "Type" "Priority" "Status" "Age" "Reporter" "Assignee" -}}
|
||||
{{- range .issues -}}
|
||||
{{- row -}}
|
||||
{{- cell .key -}}
|
||||
{{- cell .fields.summary -}}
|
||||
{{- cell .fields.issuetype.name -}}
|
||||
{{- if .fields.priority -}}
|
||||
{{- cell .fields.priority.name -}}
|
||||
{{- else -}}
|
||||
{{- cell "<none>" -}}
|
||||
{{- end -}}
|
||||
{{- cell .fields.status.name -}}
|
||||
{{- cell (.fields.created | age) -}}
|
||||
{{- if .fields.reporter -}}
|
||||
{{- cell .fields.reporter.name -}}
|
||||
{{- else -}}
|
||||
{{- cell "<unknown>" -}}
|
||||
{{- end -}}
|
||||
{{- if .fields.assignee -}}
|
||||
{{- cell .fields.assignee.name -}}
|
||||
{{- else -}}
|
||||
{{- cell "<unassigned>" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{$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.issuetype.name | printf "%-12s" }} | {{if .fields.priority}}{{.fields.priority.name | printf "%-12s" }}{{else}}<unassigned>{{end}} | {{.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 14 }}+{{ "-" | rep 12 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+
|
||||
`
|
||||
|
||||
const defaultAttachListTemplate = `{{/* attach list template */ -}}
|
||||
{{- headers "id" "filename" "bytes" "user" "created" -}}
|
||||
{{- range . -}}
|
||||
{{- row -}}
|
||||
{{- cell .id -}}
|
||||
{{- cell .filename -}}
|
||||
{{- cell .size -}}
|
||||
{{- cell .author.name -}}
|
||||
{{- cell (.created | age) -}}
|
||||
{{- end -}}
|
||||
const defaultAttachListTemplate = `{{/* table template */ -}}
|
||||
+{{ "-" | rep 12 }}+{{ "-" | rep 30 }}+{{ "-" | rep 12 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+
|
||||
| {{printf "%-10s" "id"}} | {{printf "%-28s" "filename"}} | {{printf "%-10s" "bytes"}} | {{printf "%-12s" "user"}} | {{printf "%-12s" "created"}} |
|
||||
+{{ "-" | rep 12 }}+{{ "-" | rep 30 }}+{{ "-" | rep 12 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+
|
||||
{{range . -}}
|
||||
| {{.id | printf "%10d" }} | {{.filename | printf "%-28s"}} | {{.size | printf "%10d"}} | {{.author.name | printf "%-12s"}} | {{.created | age | printf "%-12s"}} |
|
||||
{{end -}}
|
||||
+{{ "-" | rep 12 }}+{{ "-" | rep 30 }}+{{ "-" | rep 12 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+
|
||||
`
|
||||
|
||||
const defaultViewTemplate = `{{/* view template */ -}}
|
||||
@@ -411,7 +353,7 @@ const defaultEditTemplate = `{{/* edit template */ -}}
|
||||
# issue: {{ .key }} - created: {{ .fields.created | age}} ago
|
||||
update:
|
||||
comment:
|
||||
- add:
|
||||
- add:
|
||||
body: |~
|
||||
{{ or .overrides.comment "" | indent 10 }}
|
||||
fields:
|
||||
@@ -541,7 +483,7 @@ const defaultTransitionTemplate = `{{/* transition template */ -}}
|
||||
{{- if .meta.fields.comment }}
|
||||
update:
|
||||
comment:
|
||||
- add:
|
||||
- add:
|
||||
body: |~
|
||||
{{ or .overrides.comment "" | indent 10 }}
|
||||
{{- end -}}
|
||||
@@ -604,7 +546,7 @@ transition:
|
||||
const defaultWorklogTemplate = `{{/* worklog template */ -}}
|
||||
# issue: {{ .issue }}
|
||||
comment: |~
|
||||
{{ or .comment "" | indent 2 }}
|
||||
{{ or .comment "" }}
|
||||
timeSpent: {{ or .timeSpent "" }}
|
||||
started: {{ or .started "" }}
|
||||
`
|
||||
|
||||
+9
-8
@@ -11,7 +11,7 @@ import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/kingpeon"
|
||||
"github.com/coryb/oreo"
|
||||
jira "github.com/Kuchenm0nster/jira"
|
||||
jira "gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
@@ -173,7 +173,7 @@ func ParseCommandLine(app *kingpin.Application, args []string) {
|
||||
if ctx.SelectedCommand == nil {
|
||||
next := ctx.Next()
|
||||
if next != nil {
|
||||
if ok, err := regexp.MatchString("^([A-Z]+-)?[0-9]+$", next.Value); err != nil {
|
||||
if ok, err := regexp.MatchString("^[A-Z]+-[0-9]+$", next.Value); err != nil {
|
||||
log.Errorf("Invalid Regex: %s", err)
|
||||
} else if ok {
|
||||
// insert "view" at i=1 (2nd position)
|
||||
@@ -187,12 +187,13 @@ func ParseCommandLine(app *kingpin.Application, args []string) {
|
||||
if _, ok := err.(*Error); ok {
|
||||
log.Errorf("%s", err)
|
||||
panic(Exit{Code: 1})
|
||||
} else {
|
||||
ctx, _ := app.ParseContext(os.Args[1:])
|
||||
if ctx != nil {
|
||||
app.UsageForContext(ctx)
|
||||
}
|
||||
log.Errorf("Invalid Usage: %s", err)
|
||||
panic(Exit{Code: 1})
|
||||
}
|
||||
ctx, _ := app.ParseContext(os.Args[1:])
|
||||
if ctx != nil {
|
||||
app.UsageForContext(ctx)
|
||||
}
|
||||
log.Errorf("Invalid Usage: %s", err)
|
||||
panic(Exit{Code: 1})
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
package jiracli
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
@@ -30,7 +31,7 @@ func findClosestParentPath(fileName string) (string, error) {
|
||||
if len(paths) > 0 {
|
||||
return paths[len(paths)-1], nil
|
||||
}
|
||||
return "", fmt.Errorf("%s not found in parent directory hierarchy", fileName)
|
||||
return "", errors.New(fmt.Sprintf("%s not found in parent directory hierarchy", fileName))
|
||||
}
|
||||
|
||||
func tmpYml(tmpFilePrefix string) (*os.File, error) {
|
||||
@@ -85,7 +86,7 @@ func fuzzyAge(start string) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
delta := time.Since(t)
|
||||
delta := time.Now().Sub(t)
|
||||
if delta.Minutes() < 2 {
|
||||
return "a minute", nil
|
||||
} else if dm := delta.Minutes(); dm < 45 {
|
||||
|
||||
+2
-4
@@ -5,14 +5,13 @@ import (
|
||||
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
type AssignOptions struct {
|
||||
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
|
||||
Assignee string `yaml:"assignee,omitempty" json:"assignee,omitempty"`
|
||||
}
|
||||
@@ -27,7 +26,6 @@ func CmdAssignRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdAssignUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||
return CmdAssign(o, globals, &opts)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -9,15 +9,14 @@ import (
|
||||
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
jira "github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
jira "gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
yaml "gopkg.in/coryb/yaml.v2"
|
||||
)
|
||||
|
||||
type AttachCreateOptions struct {
|
||||
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
|
||||
Attachment string `yaml:"attachment,omitempty" json:"attachment,omitempty"`
|
||||
Filename string `yaml:"filename,omitempty" json:"filename,omitempty"`
|
||||
@@ -34,7 +33,6 @@ func CmdAttachCreateRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdAttachCreateUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||
return CmdAttachCreate(o, globals, &opts)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
jira "github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
jira "gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
|
||||
@@ -5,15 +5,14 @@ import (
|
||||
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
type AttachListOptions struct {
|
||||
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
|
||||
}
|
||||
|
||||
@@ -31,7 +30,6 @@ func CmdAttachListRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdAttachListUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||
return CmdAttachList(o, globals, &opts)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
jira "github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
jira "gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
|
||||
+3
-6
@@ -6,16 +6,15 @@ import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
type BlockOptions struct {
|
||||
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
jiradata.LinkIssueRequest `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||
}
|
||||
|
||||
func CmdBlockRegistry() *jiracli.CommandRegistryEntry {
|
||||
@@ -39,8 +38,6 @@ func CmdBlockRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdBlockUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.OutwardIssue.Key = jiracli.FormatIssue(opts.OutwardIssue.Key, opts.Project)
|
||||
opts.InwardIssue.Key = jiracli.FormatIssue(opts.InwardIssue.Key, opts.Project)
|
||||
return CmdBlock(o, globals, &opts)
|
||||
},
|
||||
}
|
||||
|
||||
+5
-11
@@ -3,29 +3,23 @@ package jiracmd
|
||||
import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
jira "github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"github.com/pkg/browser"
|
||||
jira "gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
type BrowseOptions struct {
|
||||
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
|
||||
}
|
||||
|
||||
func CmdBrowseRegistry() *jiracli.CommandRegistryEntry {
|
||||
opts := BrowseOptions{}
|
||||
issue := ""
|
||||
|
||||
return &jiracli.CommandRegistryEntry{
|
||||
"Open issue in browser",
|
||||
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
|
||||
cmd.Arg("ISSUE", "Issue to browse to").Required().StringVar(&opts.Issue)
|
||||
cmd.Arg("ISSUE", "Issue to browse to").Required().StringVar(&issue)
|
||||
return nil
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||
return CmdBrowse(globals, opts.Issue)
|
||||
return CmdBrowse(globals, issue)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
+3
-5
@@ -6,15 +6,14 @@ import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
type CommentOptions struct {
|
||||
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||
Overrides map[string]string `yaml:"overrides,omitempty" json:"overrides,omitempty"`
|
||||
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
|
||||
}
|
||||
@@ -34,7 +33,6 @@ func CmdCommentRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdCommentUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||
return CmdComment(o, globals, &opts)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
@@ -52,8 +52,9 @@ func CmdComponentAddUsage(cmd *kingpin.CmdClause, opts *ComponentAddOptions) err
|
||||
func CmdComponentAdd(o *oreo.Client, globals *jiracli.GlobalOptions, opts *ComponentAddOptions) error {
|
||||
var err error
|
||||
component := &jiradata.Component{}
|
||||
var resp *jiradata.Component
|
||||
err = jiracli.EditLoop(&opts.CommonOptions, &opts.Component, component, func() error {
|
||||
_, err = jira.CreateComponent(o, globals.Endpoint.Value, component)
|
||||
resp, err = jira.CreateComponent(o, globals.Endpoint.Value, component)
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
|
||||
+3
-3
@@ -7,9 +7,9 @@ import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
yaml "gopkg.in/coryb/yaml.v2"
|
||||
)
|
||||
|
||||
@@ -3,8 +3,8 @@ package jiracmd
|
||||
import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
|
||||
+28
-30
@@ -6,16 +6,17 @@ import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
type DupOptions struct {
|
||||
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
jiradata.LinkIssueRequest `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||
Duplicate string `yaml:"duplicate,omitempty" json:"duplicate,omitempty"`
|
||||
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
|
||||
}
|
||||
|
||||
func CmdDupRegistry() *jiracli.CommandRegistryEntry {
|
||||
@@ -39,8 +40,6 @@ func CmdDupRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdDupUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.OutwardIssue.Key = jiracli.FormatIssue(opts.OutwardIssue.Key, opts.Project)
|
||||
opts.InwardIssue.Key = jiracli.FormatIssue(opts.InwardIssue.Key, opts.Project)
|
||||
return CmdDup(o, globals, &opts)
|
||||
},
|
||||
}
|
||||
@@ -61,7 +60,7 @@ func CmdDupUsage(cmd *kingpin.CmdClause, opts *DupOptions) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// CmdDup will update the given issue as being a duplicate by the given dup issue
|
||||
// CmdDups will update the given issue as being a duplicate by the given dup issue
|
||||
// and will attempt to resolve the dup issue
|
||||
func CmdDup(o *oreo.Client, globals *jiracli.GlobalOptions, opts *DupOptions) error {
|
||||
if err := jira.LinkIssues(o, globals.Endpoint.Value, &opts.LinkIssueRequest); err != nil {
|
||||
@@ -77,30 +76,29 @@ func CmdDup(o *oreo.Client, globals *jiracli.GlobalOptions, opts *DupOptions) er
|
||||
}
|
||||
for _, trans := range []string{"close", "done", "cancel", "start", "stop"} {
|
||||
transMeta := meta.Transitions.Find(trans)
|
||||
if transMeta == nil {
|
||||
continue
|
||||
}
|
||||
issueUpdate := jiradata.IssueUpdate{
|
||||
Transition: transMeta,
|
||||
}
|
||||
resolution := defaultResolution(transMeta)
|
||||
if resolution != "" {
|
||||
issueUpdate.Fields = map[string]interface{}{
|
||||
"resolution": map[string]interface{}{
|
||||
"name": resolution,
|
||||
},
|
||||
if transMeta != nil {
|
||||
issueUpdate := jiradata.IssueUpdate{
|
||||
Transition: transMeta,
|
||||
}
|
||||
resolution := defaultResolution(transMeta)
|
||||
if resolution != "" {
|
||||
issueUpdate.Fields = map[string]interface{}{
|
||||
"resolution": map[string]interface{}{
|
||||
"name": resolution,
|
||||
},
|
||||
}
|
||||
}
|
||||
if err = jira.TransitionIssue(o, globals.Endpoint.Value, opts.InwardIssue.Key, &issueUpdate); err != nil {
|
||||
return err
|
||||
}
|
||||
if trans != "start" {
|
||||
break
|
||||
}
|
||||
// if we are here then we must be stopping, so need to reset the meta
|
||||
meta, err = jira.GetIssueTransitions(o, globals.Endpoint.Value, opts.InwardIssue.Key)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err = jira.TransitionIssue(o, globals.Endpoint.Value, opts.InwardIssue.Key, &issueUpdate); err != nil {
|
||||
return err
|
||||
}
|
||||
if trans != "start" {
|
||||
break
|
||||
}
|
||||
// if we are here then we must be stopping, so need to reset the meta
|
||||
meta, err = jira.GetIssueTransitions(o, globals.Endpoint.Value, opts.InwardIssue.Key)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+18
-17
@@ -5,10 +5,10 @@ import (
|
||||
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"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"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
@@ -36,7 +36,6 @@ func CmdEditRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdEditUsage(cmd, &opts, fig)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||
if opts.QueryFields == "" {
|
||||
opts.QueryFields = "assignee,created,priority,reporter,status,summary,updated,issuetype,comment,description,votes,created,customfield_10110,components"
|
||||
}
|
||||
@@ -125,20 +124,22 @@ func CmdEdit(o *oreo.Client, globals *jiracli.GlobalOptions, opts *EditOptions)
|
||||
err = jiracli.EditLoop(&opts.CommonOptions, &input, &issueUpdate, func() error {
|
||||
return jira.EditIssue(o, globals.Endpoint.Value, issueData.Key, &issueUpdate)
|
||||
})
|
||||
if err == jiracli.EditLoopAbort && 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
|
||||
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})
|
||||
}
|
||||
panic(jiracli.Exit{1})
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
+3
-5
@@ -3,14 +3,13 @@ package jiracmd
|
||||
import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
type EditMetaOptions struct {
|
||||
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
|
||||
}
|
||||
|
||||
@@ -29,7 +28,6 @@ func CmdEditMetaRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdEditMetaUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||
return CmdEditMeta(o, globals, &opts)
|
||||
},
|
||||
}
|
||||
@@ -43,7 +41,7 @@ func CmdEditMetaUsage(cmd *kingpin.CmdClause, opts *EditMetaOptions) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// CmdEditMeta will get issue edit metadata and send to "editmeta" template
|
||||
// EditMeta will get issue edit metadata and send to "editmeta" template
|
||||
func CmdEditMeta(o *oreo.Client, globals *jiracli.GlobalOptions, opts *EditMetaOptions) error {
|
||||
editMeta, err := jira.GetIssueEditMeta(o, globals.Endpoint.Value, opts.Issue)
|
||||
if err != nil {
|
||||
|
||||
+3
-8
@@ -6,15 +6,14 @@ import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
type EpicAddOptions struct {
|
||||
jiradata.EpicIssues `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||
Epic string `yaml:"epic,omitempty" json:"epic,omitempty"`
|
||||
}
|
||||
|
||||
@@ -28,10 +27,6 @@ func CmdEpicAddRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdEpicAddUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.Epic = jiracli.FormatIssue(opts.Epic, opts.Project)
|
||||
for i := range opts.Issues {
|
||||
opts.Issues[i] = jiracli.FormatIssue(opts.Issues[i], opts.Project)
|
||||
}
|
||||
return CmdEpicAdd(o, globals, &opts)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
|
||||
+2
-3
@@ -3,8 +3,8 @@ package jiracmd
|
||||
import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
@@ -29,7 +29,6 @@ func CmdEpicListRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdEpicListUsage(cmd, &opts, fig)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.Epic = jiracli.FormatIssue(opts.Epic, opts.Project)
|
||||
if opts.MaxResults == 0 {
|
||||
opts.MaxResults = 500
|
||||
}
|
||||
|
||||
@@ -6,15 +6,14 @@ import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
type EpicRemoveOptions struct {
|
||||
jiradata.EpicIssues `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||
}
|
||||
|
||||
func CmdEpicRemoveRegistry() *jiracli.CommandRegistryEntry {
|
||||
@@ -27,9 +26,6 @@ func CmdEpicRemoveRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdEpicRemoveUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
for i := range opts.Issues {
|
||||
opts.Issues[i] = jiracli.FormatIssue(opts.Issues[i], opts.Project)
|
||||
}
|
||||
return CmdEpicRemove(o, globals, &opts)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@ package jiracmd
|
||||
import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
@@ -16,7 +16,6 @@ type IssueLinkOptions struct {
|
||||
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
jiradata.LinkIssueRequest `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
LinkType string `yaml:"linktype,omitempty" json:"linktype,omitempty"`
|
||||
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||
}
|
||||
|
||||
func CmdIssueLinkRegistry() *jiracli.CommandRegistryEntry {
|
||||
@@ -34,8 +33,6 @@ func CmdIssueLinkRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdIssueLinkUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.OutwardIssue.Key = jiracli.FormatIssue(opts.OutwardIssue.Key, opts.Project)
|
||||
opts.InwardIssue.Key = jiracli.FormatIssue(opts.InwardIssue.Key, opts.Project)
|
||||
return CmdIssueLink(o, globals, &opts)
|
||||
},
|
||||
}
|
||||
@@ -57,7 +54,7 @@ func CmdIssueLinkUsage(cmd *kingpin.CmdClause, opts *IssueLinkOptions) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// CmdIssueLink will update the given issue as being a duplicate by the given dup issue
|
||||
// CmdBlock will update the given issue as being a duplicate by the given dup issue
|
||||
// and will attempt to resolve the dup issue
|
||||
func CmdIssueLink(o *oreo.Client, globals *jiracli.GlobalOptions, opts *IssueLinkOptions) error {
|
||||
if err := jira.LinkIssues(o, globals.Endpoint.Value, &opts.LinkIssueRequest); err != nil {
|
||||
|
||||
@@ -3,8 +3,8 @@ package jiracmd
|
||||
import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
|
||||
@@ -6,15 +6,14 @@ import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
type LabelsAddOptions struct {
|
||||
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
|
||||
Labels []string `yaml:"labels,omitempty" json:"labels,omitempty"`
|
||||
}
|
||||
@@ -28,7 +27,6 @@ func CmdLabelsAddRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdLabelsAddUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||
return CmdLabelsAdd(o, globals, &opts)
|
||||
},
|
||||
}
|
||||
@@ -41,7 +39,7 @@ func CmdLabelsAddUsage(cmd *kingpin.CmdClause, opts *LabelsAddOptions) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// CmdLabelsAdd will add labels on a given issue
|
||||
// CmdLabels will add labels on a given issue
|
||||
func CmdLabelsAdd(o *oreo.Client, globals *jiracli.GlobalOptions, opts *LabelsAddOptions) error {
|
||||
ops := jiradata.FieldOperations{}
|
||||
for _, label := range opts.Labels {
|
||||
|
||||
@@ -6,15 +6,14 @@ import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
type LabelsRemoveOptions struct {
|
||||
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
|
||||
Labels []string `yaml:"labels,omitempty" json:"labels,omitempty"`
|
||||
}
|
||||
@@ -28,7 +27,6 @@ func CmdLabelsRemoveRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdLabelsRemoveUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||
return CmdLabelsRemove(o, globals, &opts)
|
||||
},
|
||||
}
|
||||
@@ -41,7 +39,7 @@ func CmdLabelsRemoveUsage(cmd *kingpin.CmdClause, opts *LabelsRemoveOptions) err
|
||||
return nil
|
||||
}
|
||||
|
||||
// CmdLabelsRemove will remove labels on a given issue
|
||||
// CmdLabels will remove labels on a given issue
|
||||
func CmdLabelsRemove(o *oreo.Client, globals *jiracli.GlobalOptions, opts *LabelsRemoveOptions) error {
|
||||
ops := jiradata.FieldOperations{}
|
||||
for _, label := range opts.Labels {
|
||||
|
||||
@@ -6,15 +6,14 @@ import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
type LabelsSetOptions struct {
|
||||
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
|
||||
Labels []string `yaml:"labels,omitempty" json:"labels,omitempty"`
|
||||
}
|
||||
@@ -28,7 +27,6 @@ func CmdLabelsSetRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdLabelsSetUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||
return CmdLabelsSet(o, globals, &opts)
|
||||
},
|
||||
}
|
||||
@@ -41,7 +39,7 @@ func CmdLabelsSetUsage(cmd *kingpin.CmdClause, opts *LabelsSetOptions) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// CmdLabelsSet will set labels on a given issue
|
||||
// CmdLabels will set labels on a given issue
|
||||
func CmdLabelsSet(o *oreo.Client, globals *jiracli.GlobalOptions, opts *LabelsSetOptions) error {
|
||||
issueUpdate := jiradata.IssueUpdate{
|
||||
Update: jiradata.FieldOperationsMap{
|
||||
|
||||
+6
-3
@@ -5,8 +5,8 @@ import (
|
||||
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
@@ -30,6 +30,9 @@ func CmdListRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdListUsage(cmd, &opts, fig)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
if opts.MaxResults == 0 {
|
||||
opts.MaxResults = 500
|
||||
}
|
||||
if opts.QueryFields == "" {
|
||||
opts.QueryFields = "assignee,created,priority,reporter,status,summary,updated,issuetype"
|
||||
}
|
||||
@@ -69,7 +72,7 @@ func CmdListUsage(cmd *kingpin.CmdClause, opts *ListOptions, fig *figtree.FigTre
|
||||
|
||||
// List will query jira and send data to "list" template
|
||||
func CmdList(o *oreo.Client, globals *jiracli.GlobalOptions, opts *ListOptions) error {
|
||||
data, err := jira.Search(o, globals.Endpoint.Value, opts, jira.WithAutoPagination())
|
||||
data, err := jira.Search(o, globals.Endpoint.Value, opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
+2
-2
@@ -6,9 +6,9 @@ import (
|
||||
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"github.com/mgutz/ansi"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
|
||||
+2
-2
@@ -6,11 +6,11 @@ import (
|
||||
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"github.com/mgutz/ansi"
|
||||
"golang.org/x/crypto/ssh/terminal"
|
||||
survey "gopkg.in/AlecAivazis/survey.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
|
||||
+3
-6
@@ -6,15 +6,14 @@ import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
type RankOptions struct {
|
||||
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||
First string `yaml:"first,omitempty" json:"first,omitempty"`
|
||||
Second string `yaml:"second,omitempty" json:"second,omitempty"`
|
||||
Order string `yaml:"order,omitempty" json:"order,omitempty"`
|
||||
@@ -30,8 +29,6 @@ func CmdRankRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdRankUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.First = jiracli.FormatIssue(opts.First, opts.Project)
|
||||
opts.Second = jiracli.FormatIssue(opts.Second, opts.Project)
|
||||
return CmdRank(o, globals, &opts)
|
||||
},
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package jiracmd
|
||||
|
||||
import "github.com/Kuchenm0nster/jira/jiracli"
|
||||
import "gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
|
||||
func RegisterAllCommands() {
|
||||
jiracli.RegisterCommand(jiracli.CommandRegistry{Command: "acknowledge", Entry: CmdTransitionRegistry("acknowledge"), Aliases: []string{"ack"}})
|
||||
|
||||
+17
-4
@@ -3,13 +3,14 @@ package jiracmd
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
@@ -74,9 +75,21 @@ func CmdRequest(o *oreo.Client, globals *jiracli.GlobalOptions, opts *RequestOpt
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
var data interface{}
|
||||
if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
|
||||
return fmt.Errorf("JSON Parse Error: %v", err)
|
||||
content, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(content) == 0 {
|
||||
if !globals.Quiet.Value {
|
||||
fmt.Println("No content in response")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
var data interface{}
|
||||
err = json.Unmarshal(content, &data)
|
||||
if err != nil {
|
||||
return fmt.Errorf("JSON Parse Error: %s from %q", err, content)
|
||||
}
|
||||
|
||||
return opts.PrintTemplate(&data)
|
||||
}
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@ import (
|
||||
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
yaml "gopkg.in/coryb/yaml.v2"
|
||||
)
|
||||
|
||||
+3
-4
@@ -6,9 +6,9 @@ import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
@@ -36,7 +36,6 @@ func CmdSubtaskRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdSubtaskUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||
if opts.IssueType == "" {
|
||||
opts.IssueType = "Sub-task"
|
||||
}
|
||||
|
||||
+1
-2
@@ -3,7 +3,7 @@ package jiracmd
|
||||
import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
@@ -17,7 +17,6 @@ func CmdTakeRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdAssignUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||
if opts.Assignee == "" {
|
||||
opts.Assignee = globals.User.Value
|
||||
}
|
||||
|
||||
+13
-13
@@ -7,15 +7,14 @@ import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
type TransitionOptions struct {
|
||||
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||
Overrides map[string]string `yaml:"overrides,omitempty" json:"overrides,omitempty"`
|
||||
Transition string `yaml:"transition,omitempty" json:"transition,omitempty"`
|
||||
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
|
||||
@@ -46,7 +45,6 @@ func CmdTransitionRegistry(transition string) *jiracli.CommandRegistryEntry {
|
||||
return CmdTransitionUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||
return CmdTransition(o, globals, &opts)
|
||||
},
|
||||
}
|
||||
@@ -112,13 +110,15 @@ func CmdTransition(o *oreo.Client, globals *jiracli.GlobalOptions, opts *Transit
|
||||
}
|
||||
|
||||
// need to default the Resolution, usually Fixed works but sometime need Done
|
||||
if resField, ok := transMeta.Fields["resolution"]; ok && opts.Resolution == "" {
|
||||
for _, allowedValueRaw := range resField.AllowedValues {
|
||||
if allowedValue, ok := allowedValueRaw.(map[string]interface{}); ok {
|
||||
if allowedValue["name"] == "Fixed" {
|
||||
opts.Resolution = "Fixed"
|
||||
} else if allowedValue["name"] == "Done" {
|
||||
opts.Resolution = "Done"
|
||||
if opts.Resolution == "" {
|
||||
if resField, ok := transMeta.Fields["resolution"]; ok {
|
||||
for _, allowedValueRaw := range resField.AllowedValues {
|
||||
if allowedValue, ok := allowedValueRaw.(map[string]interface{}); ok {
|
||||
if allowedValue["name"] == "Fixed" {
|
||||
opts.Resolution = "Fixed"
|
||||
} else if allowedValue["name"] == "Done" {
|
||||
opts.Resolution = "Done"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,7 +129,7 @@ func CmdTransition(o *oreo.Client, globals *jiracli.GlobalOptions, opts *Transit
|
||||
*jiradata.Issue `yaml:",inline"`
|
||||
// Yes, Meta and Transition are redundant, but this is for backwards compatibility
|
||||
// with old templates
|
||||
Meta *jiradata.Transition `yaml:"meta,omitempty" json:"meta,omitempty"`
|
||||
Meta *jiradata.Transition `yaml:"meta,omitempty" json:"meta,omitemtpy"`
|
||||
Transition *jiradata.Transition `yaml:"transition,omitempty" json:"transition,omitempty"`
|
||||
Overrides map[string]string `yaml:"overrides,omitempty" json:"overrides,omitempty"`
|
||||
}
|
||||
|
||||
@@ -3,14 +3,13 @@ package jiracmd
|
||||
import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
type TransitionsOptions struct {
|
||||
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
|
||||
}
|
||||
|
||||
@@ -28,7 +27,6 @@ func CmdTransitionsRegistry(defaultTemplate string) *jiracli.CommandRegistryEntr
|
||||
return CmdTransitionsUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||
return CmdTransitions(o, globals, &opts)
|
||||
},
|
||||
}
|
||||
|
||||
+1
-2
@@ -3,7 +3,7 @@ package jiracmd
|
||||
import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
@@ -17,7 +17,6 @@ func CmdUnassignRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdAssignUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||
return CmdAssign(o, globals, &opts)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
@@ -47,13 +47,15 @@ func CmdUnexportTemplates(globals *jiracli.GlobalOptions, opts *ExportTemplatesO
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if bytes.Equal([]byte(template), contents) {
|
||||
if bytes.Compare([]byte(template), contents) == 0 {
|
||||
if !globals.Quiet.Value {
|
||||
log.Notice("Removing %s, template identical to default", templateFile)
|
||||
}
|
||||
os.Remove(templateFile)
|
||||
} else if !globals.Quiet.Value {
|
||||
log.Notice("Skipping %s, found customizations to template", templateFile)
|
||||
} else {
|
||||
if !globals.Quiet.Value {
|
||||
log.Notice("Skipping %s, found customizations to template", templateFile)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
+2
-4
@@ -3,15 +3,14 @@ package jiracmd
|
||||
import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
type ViewOptions struct {
|
||||
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
jira.IssueOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
|
||||
}
|
||||
|
||||
@@ -29,7 +28,6 @@ func CmdViewRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdViewUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||
return CmdView(o, globals, &opts)
|
||||
},
|
||||
}
|
||||
|
||||
+2
-4
@@ -6,8 +6,8 @@ import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
@@ -20,7 +20,6 @@ const (
|
||||
|
||||
type VoteOptions struct {
|
||||
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
|
||||
Action VoteAction `yaml:"-" json:"-"`
|
||||
}
|
||||
@@ -38,7 +37,6 @@ func CmdVoteRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdVoteUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||
return CmdVote(o, globals, &opts)
|
||||
},
|
||||
}
|
||||
|
||||
+2
-4
@@ -6,8 +6,8 @@ import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
@@ -20,7 +20,6 @@ const (
|
||||
|
||||
type WatchOptions struct {
|
||||
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
|
||||
Watcher string `yaml:"watcher,omitempty" json:"watcher,omitempty"`
|
||||
Action WatchAction `yaml:"-" json:"-"`
|
||||
@@ -39,7 +38,6 @@ func CmdWatchRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdWatchUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||
return CmdWatch(o, globals, &opts)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -5,16 +5,15 @@ import (
|
||||
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
type WorklogAddOptions struct {
|
||||
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
jiradata.Worklog `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
|
||||
}
|
||||
|
||||
@@ -31,7 +30,6 @@ func CmdWorklogAddRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdWorklogAddUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||
return CmdWorklogAdd(o, globals, &opts)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -3,15 +3,14 @@ package jiracmd
|
||||
import (
|
||||
"github.com/coryb/figtree"
|
||||
"github.com/coryb/oreo"
|
||||
"github.com/Kuchenm0nster/jira"
|
||||
"github.com/Kuchenm0nster/jira/jiracli"
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
type WorklogListOptions struct {
|
||||
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
|
||||
}
|
||||
|
||||
@@ -28,7 +27,6 @@ func CmdWorklogListRegistry() *jiracli.CommandRegistryEntry {
|
||||
return CmdWorklogListUsage(cmd, &opts)
|
||||
},
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||
return CmdWorklogList(o, globals, &opts)
|
||||
},
|
||||
}
|
||||
@@ -42,7 +40,7 @@ func CmdWorklogListUsage(cmd *kingpin.CmdClause, opts *WorklogListOptions) error
|
||||
return nil
|
||||
}
|
||||
|
||||
// CmdWorklogList will get worklog data for given issue and sent to the "worklogs" template
|
||||
// // CmdWorklogList will get worklog data for given issue and sent to the "worklogs" template
|
||||
func CmdWorklogList(o *oreo.Client, globals *jiracli.GlobalOptions, opts *WorklogListOptions) error {
|
||||
data, err := jira.GetIssueWorklog(o, globals.Endpoint.Value, opts.Issue)
|
||||
if err != nil {
|
||||
|
||||
@@ -9,17 +9,10 @@ import (
|
||||
// or nil
|
||||
func (t Transitions) Find(name string) *Transition {
|
||||
name = strings.ToLower(name)
|
||||
matches := Transitions{}
|
||||
for _, trans := range t {
|
||||
if strings.ToLower(trans.Name) == name {
|
||||
if strings.Contains(strings.ToLower(trans.Name), name) {
|
||||
return trans
|
||||
}
|
||||
if strings.Contains(strings.ToLower(trans.Name), name) {
|
||||
matches = append(matches, trans)
|
||||
}
|
||||
}
|
||||
if len(matches) > 0 {
|
||||
return matches[0]
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
+2
-24
@@ -1,9 +1,7 @@
|
||||
package jira
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
)
|
||||
|
||||
// https://docs.atlassian.com/jira/REST/cloud/#api/2/project-getProjectComponents
|
||||
@@ -21,27 +19,7 @@ func GetProjectComponents(ua HttpClient, endpoint string, project string) (*jira
|
||||
|
||||
if resp.StatusCode == 200 {
|
||||
results := jiradata.Components{}
|
||||
return &results, json.NewDecoder(resp.Body).Decode(&results)
|
||||
}
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
|
||||
// https://developer.atlassian.com/cloud/jira/platform/rest/v2#api-api-2-project-projectIdOrKey-versions-get
|
||||
func (j *Jira) GetProjectVersions(project string) (*jiradata.Versions, error) {
|
||||
return GetProjectVersions(j.UA, j.Endpoint, project)
|
||||
}
|
||||
|
||||
func GetProjectVersions(ua HttpClient, endpoint string, project string) (*jiradata.Versions, error) {
|
||||
uri := URLJoin(endpoint, "rest/api/2/project", project, "versions")
|
||||
resp, err := ua.GetJSON(uri)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode == 200 {
|
||||
results := jiradata.Versions{}
|
||||
return &results, json.NewDecoder(resp.Body).Decode(&results)
|
||||
return &results, readJSON(resp.Body, &results)
|
||||
}
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/net/html"
|
||||
)
|
||||
|
||||
func mayPanic(err error) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
resp, err := http.Get("https://docs.atlassian.com/software/jira/docs/api/REST/7.12.0/")
|
||||
mayPanic(err)
|
||||
defer resp.Body.Close()
|
||||
|
||||
capture := false
|
||||
nextCodeBlock := false
|
||||
stream := html.NewTokenizer(resp.Body)
|
||||
var buffer string
|
||||
for tt := stream.Next(); tt != html.ErrorToken; tt = stream.Next() {
|
||||
t := stream.Token()
|
||||
if t.Data == "h6" && tt == html.StartTagToken {
|
||||
capture = true
|
||||
}
|
||||
if t.Data == "h6" && tt == html.EndTagToken {
|
||||
capture = false
|
||||
if strings.Contains(strings.ToLower(buffer), "schema") {
|
||||
nextCodeBlock = true
|
||||
}
|
||||
buffer = ""
|
||||
}
|
||||
if nextCodeBlock && t.Data == "code" && tt == html.StartTagToken {
|
||||
capture = true
|
||||
}
|
||||
if nextCodeBlock && t.Data == "code" && tt == html.EndTagToken {
|
||||
capture = false
|
||||
schema := map[string]interface{}{}
|
||||
err := json.Unmarshal([]byte(buffer), &schema)
|
||||
mayPanic(err)
|
||||
title, ok := schema["title"].(string)
|
||||
if ok {
|
||||
title = strings.ReplaceAll(title, " ", "")
|
||||
fileName := fmt.Sprintf("%s.json", title)
|
||||
fmt.Printf("Writing %s\n", fileName)
|
||||
err := ioutil.WriteFile(fileName, []byte(buffer), 0644)
|
||||
mayPanic(err)
|
||||
}
|
||||
buffer = ""
|
||||
nextCodeBlock = false
|
||||
}
|
||||
if capture && tt == html.TextToken {
|
||||
buffer += t.Data
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python
|
||||
from lxml import html
|
||||
import requests
|
||||
import json
|
||||
|
||||
page = requests.get('https://docs.atlassian.com/jira/REST/cloud')
|
||||
tree = html.fromstring(page.content)
|
||||
|
||||
schemas = tree.xpath("//div[@class='representation-doc-block']//code/text()")
|
||||
|
||||
for schema in schemas:
|
||||
try:
|
||||
data = json.loads(schema)
|
||||
if "title" in data:
|
||||
title = data["title"].replace(" ", "")
|
||||
print "Writing {}.json".format(title)
|
||||
with open("{}.json".format(title), 'w') as f:
|
||||
f.write(schema)
|
||||
except:
|
||||
True
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
)
|
||||
|
||||
type SearchProvider interface {
|
||||
@@ -73,71 +73,26 @@ func (o *SearchOptions) ProvideSearchRequest() *jiradata.SearchRequest {
|
||||
}
|
||||
|
||||
// https://docs.atlassian.com/jira/REST/cloud/#api/2/search-searchUsingSearchRequest
|
||||
func (j *Jira) Search(sp SearchProvider, opts ...SearchOpt) (*jiradata.SearchResults, error) {
|
||||
return Search(j.UA, j.Endpoint, sp, opts...)
|
||||
func (j *Jira) Search(sp SearchProvider) (*jiradata.SearchResults, error) {
|
||||
return Search(j.UA, j.Endpoint, sp)
|
||||
}
|
||||
|
||||
type searchConfig struct {
|
||||
autoPaginate bool
|
||||
}
|
||||
|
||||
type SearchOpt func(*searchConfig)
|
||||
|
||||
func WithAutoPagination() SearchOpt {
|
||||
return func(c *searchConfig) {
|
||||
c.autoPaginate = true
|
||||
}
|
||||
}
|
||||
|
||||
func Search(ua HttpClient, endpoint string, sp SearchProvider, opts ...SearchOpt) (*jiradata.SearchResults, error) {
|
||||
c := &searchConfig{}
|
||||
for _, opt := range opts {
|
||||
opt(c)
|
||||
}
|
||||
|
||||
func Search(ua HttpClient, endpoint string, sp SearchProvider) (*jiradata.SearchResults, error) {
|
||||
req := sp.ProvideSearchRequest()
|
||||
limit := req.MaxResults
|
||||
if limit == 0 {
|
||||
// max page size is 100
|
||||
req.MaxResults = 100
|
||||
encoded, err := json.Marshal(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
issues := jiradata.Issues{}
|
||||
for {
|
||||
encoded, err := json.Marshal(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
uri := URLJoin(endpoint, "rest/api/2/search")
|
||||
resp, err := ua.Post(uri, "application/json", bytes.NewBuffer(encoded))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
|
||||
page := &jiradata.SearchResults{}
|
||||
err = json.NewDecoder(resp.Body).Decode(page)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !c.autoPaginate {
|
||||
return page, nil
|
||||
}
|
||||
|
||||
issues = append(issues, page.Issues...)
|
||||
// if we are done paginating just force all issues onto current
|
||||
// response and return
|
||||
if (limit > 0 && len(issues) >= limit) || len(issues) >= page.Total {
|
||||
page.Issues = issues
|
||||
return page, nil
|
||||
}
|
||||
req.StartAt = len(issues)
|
||||
if len(issues)+req.MaxResults > limit {
|
||||
req.MaxResults = limit - len(issues)
|
||||
}
|
||||
uri := URLJoin(endpoint, "rest/api/2/search")
|
||||
resp, err := ua.Post(uri, "application/json", bytes.NewBuffer(encoded))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode == 200 {
|
||||
results := &jiradata.SearchResults{}
|
||||
return results, readJSON(resp.Body, results)
|
||||
}
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
|
||||
+3
-3
@@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/Kuchenm0nster/jira/jiradata"
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
)
|
||||
|
||||
type AuthProvider interface {
|
||||
@@ -43,7 +43,7 @@ func NewSession(ua HttpClient, endpoint string, ap AuthProvider) (*jiradata.Auth
|
||||
|
||||
if resp.StatusCode == 200 {
|
||||
results := &jiradata.AuthSuccess{}
|
||||
return results, json.NewDecoder(resp.Body).Decode(results)
|
||||
return results, readJSON(resp.Body, results)
|
||||
}
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
@@ -63,7 +63,7 @@ func GetSession(ua HttpClient, endpoint string) (*jiradata.CurrentUser, error) {
|
||||
|
||||
if resp.StatusCode == 200 {
|
||||
results := &jiradata.CurrentUser{}
|
||||
return results, json.NewDecoder(resp.Body).Decode(results)
|
||||
return results, readJSON(resp.Body, results)
|
||||
}
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ cd $(dirname $0)
|
||||
jira="../jira"
|
||||
. env.sh
|
||||
|
||||
PLAN 98
|
||||
PLAN 94
|
||||
|
||||
# reset login
|
||||
RUNS $jira logout
|
||||
@@ -66,11 +66,11 @@ EOF
|
||||
|
||||
RUNS $jira ls --project BASIC --template table
|
||||
DIFF <<EOF
|
||||
+------------+---------+------+----------+--------+----------+----------+----------+
|
||||
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
|
||||
+------------+---------+------+----------+--------+----------+----------+----------+
|
||||
| $issue | summary | Bug | 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
|
||||
|
||||
###############################################################################
|
||||
@@ -567,15 +567,3 @@ labels: better-label, more-label
|
||||
description: |
|
||||
blocks
|
||||
EOF
|
||||
|
||||
###############################################################################
|
||||
## List 102 closed issues, should be more than 100 (max page size), verify pagination
|
||||
###############################################################################
|
||||
RUNS $jira ls -q "project = 'BASIC' AND status = 'Done'" --limit 102
|
||||
IS $(wc -l <$OSHT_STDOUT) -eq 102
|
||||
|
||||
###############################################################################
|
||||
## List 1 issue, verify we dont get full page
|
||||
###############################################################################
|
||||
RUNS $jira ls -q "project = 'BASIC' AND status = 'Done'" --limit 1
|
||||
IS $(wc -l <$OSHT_STDOUT) -eq 1
|
||||
@@ -72,9 +72,9 @@ EOF
|
||||
|
||||
RUNS $jira mine
|
||||
DIFF <<EOF
|
||||
+------------+---------+------+----------+--------+----------+----------+----------+
|
||||
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
|
||||
+------------+---------+------+----------+--------+----------+----------+----------+
|
||||
| $issue | summary | Bug | 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
|
||||
@@ -46,10 +46,10 @@ EOF
|
||||
RUNS $jira epic list $epic
|
||||
|
||||
DIFF<<EOF
|
||||
+-------+---------+------+----------+--------+-----+----------+----------+
|
||||
| Issue | Summary | Type | 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 | Type | Priority | Status | Age | Reporter | Assignee |
|
||||
+------------+---------+------+----------+--------+----------+----------+----------+
|
||||
| $issue1 | summary | Bug | Medium | To Do | a minute | gojira | gojira |
|
||||
| $issue2 | summary | Bug | 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 | Type | Priority | Status | Age | Reporter | Assignee |
|
||||
+------------+---------+------+----------+--------+----------+----------+----------+
|
||||
| $issue2 | summary | Bug | 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 | Type | Priority | Status | Age | Reporter | Assignee |
|
||||
+-------+---------+------+----------+--------+-----+----------+----------+
|
||||
+-------+---------+------+----------+--------+-----+----------+----------+
|
||||
+----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
|
||||
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
|
||||
+----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
|
||||
+----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
|
||||
EOF
|
||||
@@ -59,13 +59,13 @@ EOF
|
||||
###############################################################################
|
||||
RUNS $jira attach list $issue
|
||||
DIFF <<EOF
|
||||
+-------+-------------+---------+--------+----------+
|
||||
| id | filename | bytes | user | created |
|
||||
+-------+-------------+---------+--------+----------+
|
||||
| $attach1 | README.md | 1239 | gojira | a minute |
|
||||
| $attach2 | garbage.bin | 1048576 | gojira | a minute |
|
||||
| $attach3 | foobar.bin | 1048576 | gojira | a minute |
|
||||
+-------+-------------+---------+--------+----------+
|
||||
+------------+------------------------------+------------+--------------+--------------+
|
||||
| id | filename | bytes | user | created |
|
||||
+------------+------------------------------+------------+--------------+--------------+
|
||||
| $(printf %10s $attach1) | README.md | 1238 | gojira | a minute |
|
||||
| $(printf %10s $attach2) | garbage.bin | 1048576 | gojira | a minute |
|
||||
| $(printf %10s $attach3) | foobar.bin | 1048576 | gojira | a minute |
|
||||
+------------+------------------------------+------------+--------------+--------------+
|
||||
EOF
|
||||
|
||||
###############################################################################
|
||||
@@ -146,12 +146,12 @@ EOF
|
||||
|
||||
RUNS $jira attach list $issue
|
||||
DIFF <<EOF
|
||||
+-------+-------------+---------+--------+----------+
|
||||
| id | filename | bytes | user | created |
|
||||
+-------+-------------+---------+--------+----------+
|
||||
| $attach2 | garbage.bin | 1048576 | gojira | a minute |
|
||||
| $attach3 | foobar.bin | 1048576 | gojira | a minute |
|
||||
+-------+-------------+---------+--------+----------+
|
||||
+------------+------------------------------+------------+--------------+--------------+
|
||||
| id | filename | bytes | user | created |
|
||||
+------------+------------------------------+------------+--------------+--------------+
|
||||
| $(printf %10s $attach2) | garbage.bin | 1048576 | gojira | a minute |
|
||||
| $(printf %10s $attach3) | foobar.bin | 1048576 | gojira | a minute |
|
||||
+------------+------------------------------+------------+--------------+--------------+
|
||||
EOF
|
||||
|
||||
|
||||
@@ -165,11 +165,11 @@ EOF
|
||||
|
||||
RUNS $jira attach list $issue
|
||||
DIFF <<EOF
|
||||
+-------+------------+---------+--------+----------+
|
||||
| id | filename | bytes | user | created |
|
||||
+-------+------------+---------+--------+----------+
|
||||
| $attach3 | foobar.bin | 1048576 | gojira | a minute |
|
||||
+-------+------------+---------+--------+----------+
|
||||
+------------+------------------------------+------------+--------------+--------------+
|
||||
| id | filename | bytes | user | created |
|
||||
+------------+------------------------------+------------+--------------+--------------+
|
||||
| $(printf %10s $attach3) | foobar.bin | 1048576 | gojira | a minute |
|
||||
+------------+------------------------------+------------+--------------+--------------+
|
||||
EOF
|
||||
|
||||
###############################################################################
|
||||
@@ -182,8 +182,8 @@ EOF
|
||||
|
||||
RUNS $jira attach list $issue
|
||||
DIFF <<EOF
|
||||
+----+----------+-------+------+---------+
|
||||
| id | filename | bytes | user | created |
|
||||
+----+----------+-------+------+---------+
|
||||
+----+----------+-------+------+---------+
|
||||
+------------+------------------------------+------------+--------------+--------------+
|
||||
| id | filename | bytes | user | created |
|
||||
+------------+------------------------------+------------+--------------+--------------+
|
||||
+------------+------------------------------+------------+--------------+--------------+
|
||||
EOF
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user