Compare commits

..

1 Commits

Author SHA1 Message Date
Mike Pountney c442e2c98d Add test for findClosestParentPath to check for figtree regression
I inadvertently 'upgraded' to coryb/figtree v1.0.0, and it caused an
error in findCLosestParentPath, due to figtree.FindParentPaths having
a different function signature in v1.0.0

No idea why a regular compile isn't picking this up - but when
explicitly testing like this, we get the error detailed in #277:

```
Mikes-MBP:jira mike$ go test ./...
?       github.com/go-jira/jira [no test files]
jiracli/util.go:29:34: too many arguments in call to figtree.FindParentPaths
        have (string, string, string)
        want (string)
jiracli/util.go:29:34: too many arguments in call to figtree.FindParentPaths
        have (string, string, string)
        want (string)
FAIL    github.com/go-jira/jira/jiracli [build failed]
ok      github.com/go-jira/jira/jiradata        (cached)
Mikes-MBP:jira mike$
```
2019-09-15 21:47:49 -07:00
76 changed files with 332 additions and 735 deletions
-2
View File
@@ -8,7 +8,6 @@ language: go
go: go:
- 1.12.x - 1.12.x
- 1.13.x
env: env:
- GO111MODULE=on - GO111MODULE=on
@@ -17,5 +16,4 @@ script:
- go test ./... - go test ./...
- go vet -composites=false ./... - go vet -composites=false ./...
- make - make
- make all
- make prove 2>&1 - make prove 2>&1
-24
View File
@@ -1,29 +1,5 @@
# Changelog # 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 ## 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)] * [[#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)]
+4 -5
View File
@@ -39,11 +39,10 @@ lint:
@golint ./cmd/jira @golint ./cmd/jira
all: all:
GO111MODULE=off $(GO) get -u github.com/mitchellh/gox $(GO) get -u github.com/karalabe/xgo
rm -rf dist rm -rf dist
mkdir -p 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" ./... xgo --targets="freebsd/amd64,linux/386,linux/amd64,windows/386,windows/amd64,darwin/amd64" -dest ./dist -ldflags="-w -s" ./cmd/jira
_t/test_binaries.sh
install: install:
${MAKE} GOBIN=$$HOME/bin build ${MAKE} GOBIN=$$HOME/bin build
@@ -89,8 +88,8 @@ clean-password-store:
rm -f "$(CWD)/_t/.password-store/GoJira/api-token:mothra@corybennett.org.gpg" rm -f "$(CWD)/_t/.password-store/GoJira/api-token:mothra@corybennett.org.gpg"
test-password-store: test-password-store:
ln -s "api-token__gojira@corybennett.org.gpg" "$(CWD)/_t/.password-store/GoJira/api-token:gojira@corybennett.org.gpg" ln -s "$(CWD)/_t/.password-store/GoJira/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" ln -s "$(CWD)/_t/.password-store/GoJira/api-token__mothra@corybennett.org.gpg" "$(CWD)/_t/.password-store/GoJira/api-token:mothra@corybennett.org.gpg"
prove: test-password-store prove: test-password-store
chmod -R g-rwx,o-rwx $(CWD)/_t/.gnupg chmod -R g-rwx,o-rwx $(CWD)/_t/.gnupg
+8 -35
View File
@@ -1,5 +1,5 @@
[![Build Status](https://travis-ci.org/Kuchenm0nster/jira.svg?branch=master)](https://travis-ci.org/go-jira/jira) [![Build Status](https://travis-ci.org/go-jira/jira/go-jira.svg?branch=master)](https://travis-ci.org/go-jira/jira)
[![GoDoc](https://godoc.org/github.com/Kuchenm0nster/jira?status.svg)](https://godoc.org/github.com/go-jira/jira) [![GoDoc](https://godoc.org/github.com/go-jira/jira?status.svg)](https://godoc.org/github.com/go-jira/jira)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
# go-jira # go-jira
@@ -10,15 +10,15 @@ Simple command line client for Atlassian's Jira service written in Go.
### Download ### 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/go-jira/jira/releases).
### Build ### Build
You can build and install the official repository with [Go](https://golang.org/dl/): You can build and install the official repository with [Go](https://golang.org/dl/):
go get github.com/Kuchenm0nster/jira/cmd/jira go get github.com/go-jira/jira/cmd/jira
This will checkout this repository into `$GOPATH/src/github.com/Kuchenm0nster/jira/`, build, and install it. This will checkout this repository into `$GOPATH/src/github.com/go-jira/jira/`, build, and install it.
It should then be available in $GOPATH/bin/jira It should then be available in $GOPATH/bin/jira
@@ -260,7 +260,7 @@ hard-coded templates with `jira export-templates` which will write them to **~/.
#### Writing/Editing Templates #### 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/go-jira/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: 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 +274,11 @@ jira list -t debug
### Authentication ### 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. 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 #### 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: 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:
@@ -356,17 +356,6 @@ fi
export GPG_TTY=$(tty) 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 #### `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. 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.
@@ -374,19 +363,3 @@ When `password-source` is set to `stdin`, the `jira login` command will read fro
```bash ```bash
$ ./password-generator | jira login --endpoint=https://my.jira.endpoint.com --user=USERNAME $ ./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.
+5 -5
View File
@@ -66,11 +66,11 @@ EOF
RUNS $jira ls --project BASIC --template table RUNS $jira ls --project BASIC --template table
DIFF <<EOF DIFF <<EOF
+------------+---------+------+----------+--------+----------+----------+----------+ +----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee | | Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
+------------+---------+------+----------+--------+----------+----------+----------+ +----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
| $issue | summary | Bug | Medium | To Do | a minute | gojira | gojira | | $(printf %-14s $issue) | summary | Bug | Medium | To Do | a minute | gojira | gojira |
+------------+---------+------+----------+--------+----------+----------+----------+ +----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
EOF EOF
############################################################################### ###############################################################################
-48
View File
@@ -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
+5 -5
View File
@@ -72,9 +72,9 @@ EOF
RUNS $jira mine RUNS $jira mine
DIFF <<EOF DIFF <<EOF
+------------+---------+------+----------+--------+----------+----------+----------+ +----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee | | Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
+------------+---------+------+----------+--------+----------+----------+----------+ +----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
| $issue | summary | Bug | Medium | To Do | a minute | gojira | gojira | | $(printf %-14s $issue) | summary | Bug | Medium | To Do | a minute | gojira | gojira |
+------------+---------+------+----------+--------+----------+----------+----------+ +----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
EOF EOF
+19 -19
View File
@@ -46,10 +46,10 @@ EOF
RUNS $jira epic list $epic RUNS $jira epic list $epic
DIFF<<EOF DIFF<<EOF
+-------+---------+------+----------+--------+-----+----------+----------+ +----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee | | Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
+-------+---------+------+----------+--------+-----+----------+----------+ +----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
+-------+---------+------+----------+--------+-----+----------+----------+ +----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
EOF EOF
############################################################################### ###############################################################################
@@ -69,12 +69,12 @@ EOF
RUNS $jira epic list $epic RUNS $jira epic list $epic
DIFF<<EOF DIFF<<EOF
+------------+---------+------+----------+--------+----------+----------+----------+ +----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee | | Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
+------------+---------+------+----------+--------+----------+----------+----------+ +----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
| $issue1 | summary | Bug | Medium | To Do | a minute | gojira | gojira | | $(printf %-14s $issue1) | summary | Bug | Medium | To Do | a minute | gojira | gojira |
| $issue2 | summary | Bug | Medium | To Do | a minute | gojira | gojira | | $(printf %-14s $issue2) | summary | Bug | Medium | To Do | a minute | gojira | gojira |
+------------+---------+------+----------+--------+----------+----------+----------+ +----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
EOF EOF
############################################################################### ###############################################################################
@@ -92,11 +92,11 @@ EOF
RUNS $jira epic list $epic RUNS $jira epic list $epic
DIFF<<EOF DIFF<<EOF
+------------+---------+------+----------+--------+----------+----------+----------+ +----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee | | Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
+------------+---------+------+----------+--------+----------+----------+----------+ +----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
| $issue2 | summary | Bug | Medium | To Do | a minute | gojira | gojira | | $(printf %-14s $issue2) | summary | Bug | Medium | To Do | a minute | gojira | gojira |
+------------+---------+------+----------+--------+----------+----------+----------+ +----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
EOF EOF
############################################################################### ###############################################################################
@@ -114,8 +114,8 @@ EOF
RUNS $jira epic list $epic RUNS $jira epic list $epic
DIFF<<EOF DIFF<<EOF
+-------+---------+------+----------+--------+-----+----------+----------+ +----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee | | Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
+-------+---------+------+----------+--------+-----+----------+----------+ +----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
+-------+---------+------+----------+--------+-----+----------+----------+ +----------------+------------------------------------------+--------------+--------------+--------------+------------+--------------+--------------+
EOF EOF
+22 -22
View File
@@ -59,13 +59,13 @@ EOF
############################################################################### ###############################################################################
RUNS $jira attach list $issue RUNS $jira attach list $issue
DIFF <<EOF DIFF <<EOF
+-------+-------------+---------+--------+----------+ +------------+------------------------------+------------+--------------+--------------+
| id | filename | bytes | user | created | | id | filename | bytes | user | created |
+-------+-------------+---------+--------+----------+ +------------+------------------------------+------------+--------------+--------------+
| $attach1 | README.md | 1239 | gojira | a minute | | $(printf %10s $attach1) | README.md | 1239 | gojira | a minute |
| $attach2 | garbage.bin | 1048576 | gojira | a minute | | $(printf %10s $attach2) | garbage.bin | 1048576 | gojira | a minute |
| $attach3 | foobar.bin | 1048576 | gojira | a minute | | $(printf %10s $attach3) | foobar.bin | 1048576 | gojira | a minute |
+-------+-------------+---------+--------+----------+ +------------+------------------------------+------------+--------------+--------------+
EOF EOF
############################################################################### ###############################################################################
@@ -146,12 +146,12 @@ EOF
RUNS $jira attach list $issue RUNS $jira attach list $issue
DIFF <<EOF DIFF <<EOF
+-------+-------------+---------+--------+----------+ +------------+------------------------------+------------+--------------+--------------+
| id | filename | bytes | user | created | | id | filename | bytes | user | created |
+-------+-------------+---------+--------+----------+ +------------+------------------------------+------------+--------------+--------------+
| $attach2 | garbage.bin | 1048576 | gojira | a minute | | $(printf %10s $attach2) | garbage.bin | 1048576 | gojira | a minute |
| $attach3 | foobar.bin | 1048576 | gojira | a minute | | $(printf %10s $attach3) | foobar.bin | 1048576 | gojira | a minute |
+-------+-------------+---------+--------+----------+ +------------+------------------------------+------------+--------------+--------------+
EOF EOF
@@ -165,11 +165,11 @@ EOF
RUNS $jira attach list $issue RUNS $jira attach list $issue
DIFF <<EOF DIFF <<EOF
+-------+------------+---------+--------+----------+ +------------+------------------------------+------------+--------------+--------------+
| id | filename | bytes | user | created | | id | filename | bytes | user | created |
+-------+------------+---------+--------+----------+ +------------+------------------------------+------------+--------------+--------------+
| $attach3 | foobar.bin | 1048576 | gojira | a minute | | $(printf %10s $attach3) | foobar.bin | 1048576 | gojira | a minute |
+-------+------------+---------+--------+----------+ +------------+------------------------------+------------+--------------+--------------+
EOF EOF
############################################################################### ###############################################################################
@@ -182,8 +182,8 @@ EOF
RUNS $jira attach list $issue RUNS $jira attach list $issue
DIFF <<EOF DIFF <<EOF
+----+----------+-------+------+---------+ +------------+------------------------------+------------+--------------+--------------+
| id | filename | bytes | user | created | | id | filename | bytes | user | created |
+----+----------+-------+------+---------+ +------------+------------------------------+------------+--------------+--------------+
+----+----------+-------+------+---------+ +------------+------------------------------+------------+--------------+--------------+
EOF EOF
-40
View File
@@ -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
+1 -1
View File
@@ -3,7 +3,7 @@ package jira
import ( import (
"encoding/json" "encoding/json"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
) )
// https://docs.atlassian.com/jira/REST/cloud/#api/2/attachment-getAttachment // https://docs.atlassian.com/jira/REST/cloud/#api/2/attachment-getAttachment
+3 -9
View File
@@ -3,14 +3,12 @@ package main
import ( import (
"os" "os"
"path/filepath" "path/filepath"
"reflect"
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
"github.com/Kuchenm0nster/jira/jiracmd" "github.com/go-jira/jira/jiracmd"
"gopkg.in/coryb/yaml.v2"
"gopkg.in/op/go-logging.v1" "gopkg.in/op/go-logging.v1"
) )
@@ -29,11 +27,7 @@ func main() {
jiracli.InitLogging() jiracli.InitLogging()
configDir := ".config/jira" configDir := ".jira.d"
yaml.UseMapType(reflect.TypeOf(map[string]interface{}{}))
defer yaml.RestoreMapType()
fig := figtree.NewFigTree( fig := figtree.NewFigTree(
figtree.WithHome(jiracli.Homedir()), figtree.WithHome(jiracli.Homedir()),
figtree.WithEnvPrefix("JIRA"), figtree.WithEnvPrefix("JIRA"),
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
) )
type ComponentProvider interface { type ComponentProvider interface {
+1 -1
View File
@@ -9,7 +9,7 @@ import (
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
) )
// https://docs.atlassian.com/jira-software/REST/latest/#agile/1.0/epic-getIssuesForEpic // https://docs.atlassian.com/jira-software/REST/latest/#agile/1.0/epic-getIssuesForEpic
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"encoding/json" "encoding/json"
"net/http" "net/http"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
) )
func responseError(resp *http.Response) error { func responseError(resp *http.Response) error {
+1 -1
View File
@@ -3,7 +3,7 @@ package jira
import ( import (
"encoding/json" "encoding/json"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
) )
// https://docs.atlassian.com/jira/REST/cloud/#api/2/field-getFields // https://docs.atlassian.com/jira/REST/cloud/#api/2/field-getFields
+2 -9
View File
@@ -1,25 +1,19 @@
module github.com/Kuchenm0nster/jira module github.com/go-jira/jira
go 1.12 go 1.12
require ( 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/Netflix/go-expect v0.0.0-20180928190340-9d1f4485533b // indirect
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc // indirect github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc // indirect
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect
github.com/cheekybits/genny v1.0.0 // indirect github.com/cheekybits/genny v1.0.0 // indirect
github.com/coryb/figtree v1.0.1-0.20190907170512-58176d03ef0d github.com/coryb/figtree v0.0.0-20180728224503-071d1ef303df
github.com/coryb/kingpeon v0.0.0-20180107011214-9a669f143f2e github.com/coryb/kingpeon v0.0.0-20180107011214-9a669f143f2e
github.com/coryb/oreo v0.0.0-20180804211640-3e1b88fc08f1 github.com/coryb/oreo v0.0.0-20180804211640-3e1b88fc08f1
github.com/davecgh/go-spew v1.1.0 // indirect github.com/davecgh/go-spew v1.1.0 // indirect
github.com/fatih/camelcase v1.0.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/guelfey/go.dbus v0.0.0-20131113121618-f6a3a2366cc3 // indirect
github.com/hinshun/vt10x v0.0.0-20180809195222-d55458df857c // 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/jinzhu/copier v0.0.0-20180308034124-7e38e58719c3
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/kr/pretty v0.1.0 // indirect github.com/kr/pretty v0.1.0 // indirect
@@ -27,7 +21,6 @@ require (
github.com/mattn/go-colorable v0.0.9 // indirect github.com/mattn/go-colorable v0.0.9 // indirect
github.com/mattn/go-isatty v0.0.3 // indirect github.com/mattn/go-isatty v0.0.3 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b 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/browser v0.0.0-20170505125900-c90ca0c84f15
github.com/pkg/errors v0.8.0 github.com/pkg/errors v0.8.0
github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect
+2 -18
View File
@@ -1,9 +1,3 @@
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 h1:sSQK05nvxs4UkgCJaxihteu+r+6ela3dNMm7NVmsS3c=
github.com/Netflix/go-expect v0.0.0-20180928190340-9d1f4485533b/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc= 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 h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU=
@@ -12,8 +6,8 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZq
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= 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 h1:uGGa4nei+j20rOSeDeP5Of12XVm7TGUd4dJA9RDitfE=
github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= 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 v0.0.0-20180728224503-071d1ef303df h1:cS4Z9Nlv8J4UqFbLp9ltZypgenm2p3Jeg0yqLfpH2pc=
github.com/coryb/figtree v1.0.1-0.20190907170512-58176d03ef0d/go.mod h1:uAkZUEGm6dROpxfy+8vXLs7JrLCI4O+gQyKAuISxI/g= github.com/coryb/figtree v0.0.0-20180728224503-071d1ef303df/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 h1:tGmk9Tuyz7fKuBq/d3nFJvVWRvc48MEBKQC4uYV3wb0=
github.com/coryb/kingpeon v0.0.0-20180107011214-9a669f143f2e/go.mod h1:gBc0uEH6swbOMoR7VkVuW7w5fGvZu/KHeSgxBR4Ta7Q= 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 h1:Hh0qSvmvoAGL8VxvEoUv9UuUf9XlKcQtSxAMTz1kqfE=
@@ -22,16 +16,10 @@ 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/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 h1:hxNvNX/xYBp0ovncs8WyWZrOrpBNub/JfaMvbURyft8=
github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc= 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 h1:fngCxKbvZdctIsWj2hYijhAt4iK0JXSSA78B36xP0yI=
github.com/guelfey/go.dbus v0.0.0-20131113121618-f6a3a2366cc3/go.mod h1:0CNX5Cvi77WEH8llpfZ/ieuqyceb1cnO5//b5zzsnF8= 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 h1:kp3AxgXgDOmIJFR7bIwqFhwJ2qWar8tEQSE5XXhCfVk=
github.com/hinshun/vt10x v0.0.0-20180809195222-d55458df857c/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A= 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 h1:sHsPfNMAG70QAvKbddQ0uScZCHQoZsT5NykGRCeeeIs=
github.com/jinzhu/copier v0.0.0-20180308034124-7e38e58719c3/go.mod h1:yL958EeXv8Ylng6IfnvG4oflryUi3vgA3xPs9hmII1s= 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 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
@@ -47,12 +35,8 @@ github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRU
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= 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 h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= 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 h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= 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 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/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 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
) )
type IssueQueryProvider interface { type IssueQueryProvider interface {
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"github.com/coryb/oreo" "github.com/coryb/oreo"
) )
const VERSION = "1.0.22" const VERSION = "1.0.20"
type Jira struct { type Jira struct {
Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"` Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
-34
View File
@@ -12,7 +12,6 @@ import (
"os/exec" "os/exec"
"reflect" "reflect"
"runtime/debug" "runtime/debug"
"strconv"
"strings" "strings"
"github.com/coryb/figtree" "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 // 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"` 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 // 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 // files used by `pass`. Effectively this overrides the "PASSWORD_STORE_DIR" environment variable
PasswordDirectory figtree.StringOption `yaml:"password-directory,omitempty" json:"password-directory,omitempty"` PasswordDirectory figtree.StringOption `yaml:"password-directory,omitempty" json:"password-directory,omitempty"`
@@ -465,30 +458,3 @@ func EditLoop(opts *CommonOptions, input interface{}, output interface{}, submit
} }
return nil 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)
}
+29 -112
View File
@@ -8,7 +8,7 @@ import (
"os/exec" "os/exec"
"strings" "strings"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
"gopkg.in/AlecAivazis/survey.v1" "gopkg.in/AlecAivazis/survey.v1"
) )
@@ -31,110 +31,50 @@ func (o *GlobalOptions) keyName() string {
} }
return fmt.Sprintf("GoJira/%s", user) 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 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 { func (o *GlobalOptions) GetPass() string {
if o.cachedPassword != "" { passwd := ""
return o.cachedPassword
}
log.Debugf("Getting Password")
if o.PasswordSource.Value != "" { if o.PasswordSource.Value != "" {
log.Debugf("password-source: %s", o.PasswordSource)
if o.PasswordSource.Value == "keyring" { if o.PasswordSource.Value == "keyring" {
log.Info("Querying keyring password source.")
var err error var err error
o.cachedPassword, err = keyringGet(o.keyName()) passwd, err = keyringGet(o.keyName())
if err != nil { if err != nil {
panic(err) 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" { } else if o.PasswordSource.Value == "pass" {
log.Debugf("Querying pass password source.")
binary := o.GetPasswordPath()
if o.PasswordDirectory.Value != "" { if o.PasswordDirectory.Value != "" {
orig := os.Getenv("PASSWORD_STORE_DIR") orig := os.Getenv("PASSWORD_STORE_DIR")
log.Debugf("using password-directory: %s", o.PasswordDirectory)
os.Setenv("PASSWORD_STORE_DIR", o.PasswordDirectory.Value) os.Setenv("PASSWORD_STORE_DIR", o.PasswordDirectory.Value)
defer os.Setenv("PASSWORD_STORE_DIR", orig) defer os.Setenv("PASSWORD_STORE_DIR", orig)
} }
if passDir := os.Getenv("PASSWORD_STORE_DIR"); passDir != "" { if bin, err := exec.LookPath("pass"); err == nil {
log.Debugf("using PASSWORD_STORE_DIR=%s", passDir)
}
if bin, err := exec.LookPath(binary); err == nil {
log.Debugf("found pass at: %s", bin)
buf := bytes.NewBufferString("") buf := bytes.NewBufferString("")
cmd := exec.Command(bin, o.keyName()) cmd := exec.Command(bin, o.keyName())
cmd.Stdout = buf cmd.Stdout = buf
cmd.Stderr = os.Stderr cmd.Stderr = buf
if err := cmd.Run(); err == nil { if err := cmd.Run(); err == nil {
o.cachedPassword = strings.TrimSpace(buf.String()) passwd = strings.TrimSpace(buf.String())
} else {
log.Warningf("pass command failed with:\n%s", buf.String())
} }
} else {
log.Warning("pass binary was not found! Fallback to default password behaviour!")
} }
} else if o.PasswordSource.Value == "stdin" { } else if o.PasswordSource.Value == "stdin" {
log.Info("Reading password from stdin.")
allBytes, err := ioutil.ReadAll(os.Stdin) allBytes, err := ioutil.ReadAll(os.Stdin)
if err != nil { if err != nil {
panic(fmt.Sprintf("unable to read bytes from stdin: %s", err)) panic(fmt.Sprintf("unable to read bytes from stdin: %s", err))
} }
o.cachedPassword = string(allBytes) passwd = string(allBytes)
} else { } else {
log.Warningf("Unknown password-source: %s", o.PasswordSource) log.Warningf("Unknown password-source: %s", o.PasswordSource)
} }
} }
if o.cachedPassword != "" { if passwd != "" {
log.Info("Password cached.") return passwd
return o.cachedPassword
} }
if o.cachedPassword = os.Getenv("JIRA_API_TOKEN"); o.cachedPassword != "" && o.AuthMethod() == "api-token" { if passwd = os.Getenv("JIRA_API_TOKEN"); passwd != "" && o.AuthMethod() == "api-token" {
return o.cachedPassword return passwd
} }
prompt := fmt.Sprintf("Jira Password [%s]: ", o.Login) prompt := fmt.Sprintf("Jira Password [%s]: ", o.Login)
@@ -150,23 +90,18 @@ func (o *GlobalOptions) GetPass() string {
Message: prompt, Message: prompt,
Help: help, Help: help,
}, },
&o.cachedPassword, &passwd,
nil, nil,
) )
if err != nil { if err != nil {
log.Errorf("%s", err) log.Errorf("%s", err)
panic(Exit{Code: 1}) panic(Exit{Code: 1})
} }
o.SetPass(o.cachedPassword) o.SetPass(passwd)
return o.cachedPassword return passwd
} }
func (o *GlobalOptions) SetPass(passwd string) error { func (o *GlobalOptions) SetPass(passwd string) error {
// dont reset password to empty string
if passwd == "" {
return nil
}
if o.PasswordSource.Value == "keyring" { if o.PasswordSource.Value == "keyring" {
// save password in keychain so that it can be used for subsequent http requests // save password in keychain so that it can be used for subsequent http requests
err := keyringSet(o.keyName(), passwd) err := keyringSet(o.keyName(), passwd)
@@ -174,29 +109,6 @@ func (o *GlobalOptions) SetPass(passwd string) error {
log.Errorf("Failed to set password in keyring: %s", err) log.Errorf("Failed to set password in keyring: %s", err)
return 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" { } else if o.PasswordSource.Value == "pass" {
if o.PasswordDirectory.Value != "" { if o.PasswordDirectory.Value != "" {
orig := os.Getenv("PASSWORD_STORE_DIR") orig := os.Getenv("PASSWORD_STORE_DIR")
@@ -206,17 +118,22 @@ func (o *GlobalOptions) SetPass(passwd string) error {
if bin, err := exec.LookPath("pass"); err == nil { if bin, err := exec.LookPath("pass"); err == nil {
log.Debugf("using %s", bin) log.Debugf("using %s", bin)
passName := o.keyName() passName := o.keyName()
in := bytes.NewBufferString(fmt.Sprintf("%s\n%s\n", passwd, passwd)) if passwd != "" {
out := bytes.NewBufferString("") in := bytes.NewBufferString(fmt.Sprintf("%s\n%s\n", passwd, passwd))
cmd := exec.Command(bin, "insert", "--force", passName) out := bytes.NewBufferString("")
cmd.Stdin = in cmd := exec.Command(bin, "insert", "--force", passName)
cmd.Stdout = out cmd.Stdin = in
cmd.Stderr = out cmd.Stdout = out
if err := cmd.Run(); err != nil { cmd.Stderr = out
return fmt.Errorf("Failed to insert password: %s", out.String()) 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 != "" { } else if o.PasswordSource.Value != "" {
return fmt.Errorf("Unknown password-source: %s", o.PasswordSource) return fmt.Errorf("Unknown password-source: %s", o.PasswordSource)
+22 -79
View File
@@ -16,11 +16,9 @@ import (
yaml "gopkg.in/coryb/yaml.v2" yaml "gopkg.in/coryb/yaml.v2"
"github.com/Masterminds/sprig"
"github.com/coryb/figtree" "github.com/coryb/figtree"
shellquote "github.com/kballard/go-shellquote" shellquote "github.com/kballard/go-shellquote"
"github.com/mgutz/ansi" "github.com/mgutz/ansi"
"github.com/olekukonko/tablewriter"
"golang.org/x/crypto/ssh/terminal" "golang.org/x/crypto/ssh/terminal"
) )
@@ -36,8 +34,8 @@ func findTemplate(name string) ([]byte, error) {
} }
func getTemplate(name string) (string, error) { func getTemplate(name string) (string, error) {
if _, err := os.Stat(".jira.d/" + name); err == nil { if _, err := os.Stat(name); err == nil {
b, err := ioutil.ReadFile(".jira.d/" + name) b, err := ioutil.ReadFile(name)
if err != nil { if err != nil {
return "", err return "", err
} }
@@ -78,9 +76,6 @@ func TemplateProcessor() *template.Template {
} }
return out return out
}, },
"fit": func(size int, content string) string {
return fmt.Sprintf(fmt.Sprintf("%%-%d.%ds", size, size), content)
},
"shellquote": func(content string) string { "shellquote": func(content string) string {
return shellquote.Join(content) return shellquote.Join(content)
}, },
@@ -111,9 +106,6 @@ func TemplateProcessor() *template.Template {
} }
return 120 return 120
}, },
"pctOf": func(size, percent int) int {
return int(float32(size) * (float32(percent) / 100))
},
"sub": func(a, b int) int { "sub": func(a, b int) int {
return a - b return a - b
}, },
@@ -152,9 +144,6 @@ func TemplateProcessor() *template.Template {
"color": func(color string) string { "color": func(color string) string {
return ansi.ColorCode(color) 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 { "regReplace": func(search string, replace string, content string) string {
re := regexp.MustCompile(search) re := regexp.MustCompile(search)
return re.ReplaceAllString(content, replace) return re.ReplaceAllString(content, replace)
@@ -192,7 +181,7 @@ func TemplateProcessor() *template.Template {
return dateFormat(format, content) 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) { func ConfigTemplate(fig *figtree.FigTree, template, command string, opts interface{}) (string, error) {
@@ -254,40 +243,13 @@ func RunTemplate(templateName string, data interface{}, out io.Writer) error {
return err return err
} }
table := tablewriter.NewWriter(out) tmpl, err := TemplateProcessor().Parse(templateContent)
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)
if err != nil { if err != nil {
return err return err
} }
if err := tmpl.Execute(out, rawData); err != nil { if err := tmpl.Execute(out, rawData); err != nil {
return err return err
} }
if len(headers) > 0 || len(cells) > 0 {
table.SetHeader(headers)
table.AppendBulk(cells)
table.Render()
}
return nil return nil
} }
@@ -324,42 +286,23 @@ const defaultDebugTemplate = "{{ . | toJson}}\n"
const defaultListTemplate = "{{ range .issues }}{{ .key | append \":\" | printf \"%-12s\"}} {{ .fields.summary }}\n{{ end }}" const defaultListTemplate = "{{ range .issues }}{{ .key | append \":\" | printf \"%-12s\"}} {{ .fields.summary }}\n{{ end }}"
const defaultTableTemplate = `{{/* table template */ -}} const defaultTableTemplate = `{{/* table template */ -}}
{{- headers "Issue" "Summary" "Type" "Priority" "Status" "Age" "Reporter" "Assignee" -}} {{$w := sub termWidth 107 -}}
{{- range .issues -}} +{{ "-" | rep 16 }}+{{ "-" | rep $w }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+{{ "-" | rep 12 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+
{{- row -}} | {{ "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" }} |
{{- cell .key -}} +{{ "-" | rep 16 }}+{{ "-" | rep $w }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+{{ "-" | rep 12 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+
{{- cell .fields.summary -}} {{ range .issues -}}
{{- cell .fields.issuetype.name -}} | {{ .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}} |
{{- if .fields.priority -}} {{ end -}}
{{- cell .fields.priority.name -}} +{{ "-" | rep 16 }}+{{ "-" | rep $w }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+{{ "-" | rep 12 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+
{{- 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 -}}
` `
const defaultAttachListTemplate = `{{/* table template */ -}}
const defaultAttachListTemplate = `{{/* attach list template */ -}} +{{ "-" | rep 12 }}+{{ "-" | rep 30 }}+{{ "-" | rep 12 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+
{{- headers "id" "filename" "bytes" "user" "created" -}} | {{printf "%-10s" "id"}} | {{printf "%-28s" "filename"}} | {{printf "%-10s" "bytes"}} | {{printf "%-12s" "user"}} | {{printf "%-12s" "created"}} |
{{- range . -}} +{{ "-" | rep 12 }}+{{ "-" | rep 30 }}+{{ "-" | rep 12 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+
{{- row -}} {{range . -}}
{{- cell .id -}} | {{.id | printf "%10d" }} | {{.filename | printf "%-28s"}} | {{.size | printf "%10d"}} | {{.author.name | printf "%-12s"}} | {{.created | age | printf "%-12s"}} |
{{- cell .filename -}} {{end -}}
{{- cell .size -}} +{{ "-" | rep 12 }}+{{ "-" | rep 30 }}+{{ "-" | rep 12 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+
{{- cell .author.name -}}
{{- cell (.created | age) -}}
{{- end -}}
` `
const defaultViewTemplate = `{{/* view template */ -}} const defaultViewTemplate = `{{/* view template */ -}}
@@ -411,7 +354,7 @@ const defaultEditTemplate = `{{/* edit template */ -}}
# issue: {{ .key }} - created: {{ .fields.created | age}} ago # issue: {{ .key }} - created: {{ .fields.created | age}} ago
update: update:
comment: comment:
- add: - add:
body: |~ body: |~
{{ or .overrides.comment "" | indent 10 }} {{ or .overrides.comment "" | indent 10 }}
fields: fields:
@@ -541,7 +484,7 @@ const defaultTransitionTemplate = `{{/* transition template */ -}}
{{- if .meta.fields.comment }} {{- if .meta.fields.comment }}
update: update:
comment: comment:
- add: - add:
body: |~ body: |~
{{ or .overrides.comment "" | indent 10 }} {{ or .overrides.comment "" | indent 10 }}
{{- end -}} {{- end -}}
+2 -2
View File
@@ -11,7 +11,7 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/kingpeon" "github.com/coryb/kingpeon"
"github.com/coryb/oreo" "github.com/coryb/oreo"
jira "github.com/Kuchenm0nster/jira" jira "github.com/go-jira/jira"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
@@ -173,7 +173,7 @@ func ParseCommandLine(app *kingpin.Application, args []string) {
if ctx.SelectedCommand == nil { if ctx.SelectedCommand == nil {
next := ctx.Next() next := ctx.Next()
if next != nil { 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) log.Errorf("Invalid Regex: %s", err)
} else if ok { } else if ok {
// insert "view" at i=1 (2nd position) // insert "view" at i=1 (2nd position)
+71
View File
@@ -0,0 +1,71 @@
package jiracli
import (
"io/ioutil"
"os"
"path/filepath"
"testing"
)
func realPath(path string) string {
cpath, err := filepath.EvalSymlinks(path)
if err != nil {
log.Fatal(err)
}
return cpath
}
func comparePaths(p1 string, p2 string) bool {
if realPath(p1) == realPath(p2) {
return true
}
return false
}
func TestFindClosestParentPath(t *testing.T) {
dir, err := ioutil.TempDir("", "testFindParentPath")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(dir)
origDir, err := os.Getwd()
if err != nil {
log.Fatal(err)
}
defer os.Chdir(origDir)
t1 := filepath.Join(dir, "/.test1")
t2 := filepath.Join(t1, "/.test2")
t3 := filepath.Join(t2, "/.test1")
err = os.MkdirAll(t3, os.ModePerm)
if err != nil {
log.Fatal(err)
}
os.Chdir(t3)
path1, err := findClosestParentPath(".test1")
if err != nil {
t.Errorf("findClosestParentPath should not have errored: %s", err)
}
if ok := comparePaths(path1, t3); !ok {
t.Errorf("%s != %s", path1, t3)
}
path2, err := findClosestParentPath(".test2")
if err != nil {
t.Errorf("findClosestParentPath should not have errored: %s", err)
}
if ok := comparePaths(path2, t2); !ok {
t.Errorf("%s != %s", path2, t2)
}
path3, err := findClosestParentPath(".test3")
if err.Error() != ".test3 not found in parent directory hierarchy" {
t.Errorf("incorrect error from findClosestParentPath: %s", err)
}
if path3 != "" {
t.Errorf("path3 should be empty, but is not: %s", path3)
}
}
+2 -4
View File
@@ -5,14 +5,13 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
type AssignOptions struct { type AssignOptions struct {
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"` jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
Project string `yaml:"project,omitempty" json:"project,omitempty"`
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"` Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
Assignee string `yaml:"assignee,omitempty" json:"assignee,omitempty"` Assignee string `yaml:"assignee,omitempty" json:"assignee,omitempty"`
} }
@@ -27,7 +26,6 @@ func CmdAssignRegistry() *jiracli.CommandRegistryEntry {
return CmdAssignUsage(cmd, &opts) return CmdAssignUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
return CmdAssign(o, globals, &opts) return CmdAssign(o, globals, &opts)
}, },
} }
+2 -4
View File
@@ -9,15 +9,14 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
jira "github.com/Kuchenm0nster/jira" jira "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
yaml "gopkg.in/coryb/yaml.v2" yaml "gopkg.in/coryb/yaml.v2"
) )
type AttachCreateOptions struct { type AttachCreateOptions struct {
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"` jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
Project string `yaml:"project,omitempty" json:"project,omitempty"`
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"` Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
Attachment string `yaml:"attachment,omitempty" json:"attachment,omitempty"` Attachment string `yaml:"attachment,omitempty" json:"attachment,omitempty"`
Filename string `yaml:"filename,omitempty" json:"filename,omitempty"` Filename string `yaml:"filename,omitempty" json:"filename,omitempty"`
@@ -34,7 +33,6 @@ func CmdAttachCreateRegistry() *jiracli.CommandRegistryEntry {
return CmdAttachCreateUsage(cmd, &opts) return CmdAttachCreateUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
return CmdAttachCreate(o, globals, &opts) return CmdAttachCreate(o, globals, &opts)
}, },
} }
+2 -2
View File
@@ -7,8 +7,8 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
jira "github.com/Kuchenm0nster/jira" jira "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
+3 -5
View File
@@ -5,15 +5,14 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
type AttachListOptions struct { type AttachListOptions struct {
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"` jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
Project string `yaml:"project,omitempty" json:"project,omitempty"`
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"` Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
} }
@@ -31,7 +30,6 @@ func CmdAttachListRegistry() *jiracli.CommandRegistryEntry {
return CmdAttachListUsage(cmd, &opts) return CmdAttachListUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
return CmdAttachList(o, globals, &opts) return CmdAttachList(o, globals, &opts)
}, },
} }
+2 -2
View File
@@ -5,8 +5,8 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
jira "github.com/Kuchenm0nster/jira" jira "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
+3 -6
View File
@@ -6,16 +6,15 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
type BlockOptions struct { type BlockOptions struct {
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"` jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
jiradata.LinkIssueRequest `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 { func CmdBlockRegistry() *jiracli.CommandRegistryEntry {
@@ -39,8 +38,6 @@ func CmdBlockRegistry() *jiracli.CommandRegistryEntry {
return CmdBlockUsage(cmd, &opts) return CmdBlockUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { 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) return CmdBlock(o, globals, &opts)
}, },
} }
+5 -11
View File
@@ -3,29 +3,23 @@ package jiracmd
import ( import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
jira "github.com/Kuchenm0nster/jira" jira "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
"github.com/pkg/browser" "github.com/pkg/browser"
kingpin "gopkg.in/alecthomas/kingpin.v2" 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 { func CmdBrowseRegistry() *jiracli.CommandRegistryEntry {
opts := BrowseOptions{} issue := ""
return &jiracli.CommandRegistryEntry{ return &jiracli.CommandRegistryEntry{
"Open issue in browser", "Open issue in browser",
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error { 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 return nil
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project) return CmdBrowse(globals, issue)
return CmdBrowse(globals, opts.Issue)
}, },
} }
} }
+3 -5
View File
@@ -6,15 +6,14 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
type CommentOptions struct { type CommentOptions struct {
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"` 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"` Overrides map[string]string `yaml:"overrides,omitempty" json:"overrides,omitempty"`
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"` Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
} }
@@ -34,7 +33,6 @@ func CmdCommentRegistry() *jiracli.CommandRegistryEntry {
return CmdCommentUsage(cmd, &opts) return CmdCommentUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
return CmdComment(o, globals, &opts) return CmdComment(o, globals, &opts)
}, },
} }
+3 -3
View File
@@ -6,9 +6,9 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
+2 -2
View File
@@ -6,8 +6,8 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
+3 -3
View File
@@ -7,9 +7,9 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
yaml "gopkg.in/coryb/yaml.v2" yaml "gopkg.in/coryb/yaml.v2"
) )
+2 -2
View File
@@ -3,8 +3,8 @@ package jiracmd
import ( import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
+5 -6
View File
@@ -6,16 +6,17 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
type DupOptions struct { type DupOptions struct {
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"` jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
jiradata.LinkIssueRequest `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 { func CmdDupRegistry() *jiracli.CommandRegistryEntry {
@@ -39,8 +40,6 @@ func CmdDupRegistry() *jiracli.CommandRegistryEntry {
return CmdDupUsage(cmd, &opts) return CmdDupUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { 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) return CmdDup(o, globals, &opts)
}, },
} }
+3 -4
View File
@@ -5,9 +5,9 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
"gopkg.in/AlecAivazis/survey.v1" "gopkg.in/AlecAivazis/survey.v1"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
@@ -36,7 +36,6 @@ func CmdEditRegistry() *jiracli.CommandRegistryEntry {
return CmdEditUsage(cmd, &opts, fig) return CmdEditUsage(cmd, &opts, fig)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
if opts.QueryFields == "" { if opts.QueryFields == "" {
opts.QueryFields = "assignee,created,priority,reporter,status,summary,updated,issuetype,comment,description,votes,created,customfield_10110,components" opts.QueryFields = "assignee,created,priority,reporter,status,summary,updated,issuetype,comment,description,votes,created,customfield_10110,components"
} }
+2 -4
View File
@@ -3,14 +3,13 @@ package jiracmd
import ( import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
type EditMetaOptions struct { type EditMetaOptions struct {
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"` jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
Project string `yaml:"project,omitempty" json:"project,omitempty"`
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"` Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
} }
@@ -29,7 +28,6 @@ func CmdEditMetaRegistry() *jiracli.CommandRegistryEntry {
return CmdEditMetaUsage(cmd, &opts) return CmdEditMetaUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
return CmdEditMeta(o, globals, &opts) return CmdEditMeta(o, globals, &opts)
}, },
} }
+3 -8
View File
@@ -6,15 +6,14 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
type EpicAddOptions struct { type EpicAddOptions struct {
jiradata.EpicIssues `yaml:",inline" json:",inline" figtree:",inline"` jiradata.EpicIssues `yaml:",inline" json:",inline" figtree:",inline"`
Project string `yaml:"project,omitempty" json:"project,omitempty"`
Epic string `yaml:"epic,omitempty" json:"epic,omitempty"` Epic string `yaml:"epic,omitempty" json:"epic,omitempty"`
} }
@@ -28,10 +27,6 @@ func CmdEpicAddRegistry() *jiracli.CommandRegistryEntry {
return CmdEpicAddUsage(cmd, &opts) return CmdEpicAddUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { 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) return CmdEpicAdd(o, globals, &opts)
}, },
} }
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
+2 -3
View File
@@ -3,8 +3,8 @@ package jiracmd
import ( import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
@@ -29,7 +29,6 @@ func CmdEpicListRegistry() *jiracli.CommandRegistryEntry {
return CmdEpicListUsage(cmd, &opts, fig) return CmdEpicListUsage(cmd, &opts, fig)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
opts.Epic = jiracli.FormatIssue(opts.Epic, opts.Project)
if opts.MaxResults == 0 { if opts.MaxResults == 0 {
opts.MaxResults = 500 opts.MaxResults = 500
} }
+3 -7
View File
@@ -6,15 +6,14 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
type EpicRemoveOptions struct { type EpicRemoveOptions struct {
jiradata.EpicIssues `yaml:",inline" json:",inline" figtree:",inline"` jiradata.EpicIssues `yaml:",inline" json:",inline" figtree:",inline"`
Project string `yaml:"project,omitempty" json:"project,omitempty"`
} }
func CmdEpicRemoveRegistry() *jiracli.CommandRegistryEntry { func CmdEpicRemoveRegistry() *jiracli.CommandRegistryEntry {
@@ -27,9 +26,6 @@ func CmdEpicRemoveRegistry() *jiracli.CommandRegistryEntry {
return CmdEpicRemoveUsage(cmd, &opts) return CmdEpicRemoveUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { 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) return CmdEpicRemove(o, globals, &opts)
}, },
} }
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
+2 -2
View File
@@ -3,8 +3,8 @@ package jiracmd
import ( import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
+3 -6
View File
@@ -6,9 +6,9 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
@@ -16,7 +16,6 @@ type IssueLinkOptions struct {
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"` jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
jiradata.LinkIssueRequest `yaml:",inline" json:",inline" figtree:",inline"` jiradata.LinkIssueRequest `yaml:",inline" json:",inline" figtree:",inline"`
LinkType string `yaml:"linktype,omitempty" json:"linktype,omitempty"` LinkType string `yaml:"linktype,omitempty" json:"linktype,omitempty"`
Project string `yaml:"project,omitempty" json:"project,omitempty"`
} }
func CmdIssueLinkRegistry() *jiracli.CommandRegistryEntry { func CmdIssueLinkRegistry() *jiracli.CommandRegistryEntry {
@@ -34,8 +33,6 @@ func CmdIssueLinkRegistry() *jiracli.CommandRegistryEntry {
return CmdIssueLinkUsage(cmd, &opts) return CmdIssueLinkUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { 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) return CmdIssueLink(o, globals, &opts)
}, },
} }
+2 -2
View File
@@ -3,8 +3,8 @@ package jiracmd
import ( import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
+2 -2
View File
@@ -6,8 +6,8 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
+3 -5
View File
@@ -6,15 +6,14 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
type LabelsAddOptions struct { type LabelsAddOptions struct {
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"` jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
Project string `yaml:"project,omitempty" json:"project,omitempty"`
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"` Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
Labels []string `yaml:"labels,omitempty" json:"labels,omitempty"` Labels []string `yaml:"labels,omitempty" json:"labels,omitempty"`
} }
@@ -28,7 +27,6 @@ func CmdLabelsAddRegistry() *jiracli.CommandRegistryEntry {
return CmdLabelsAddUsage(cmd, &opts) return CmdLabelsAddUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
return CmdLabelsAdd(o, globals, &opts) return CmdLabelsAdd(o, globals, &opts)
}, },
} }
+3 -5
View File
@@ -6,15 +6,14 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
type LabelsRemoveOptions struct { type LabelsRemoveOptions struct {
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"` jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
Project string `yaml:"project,omitempty" json:"project,omitempty"`
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"` Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
Labels []string `yaml:"labels,omitempty" json:"labels,omitempty"` Labels []string `yaml:"labels,omitempty" json:"labels,omitempty"`
} }
@@ -28,7 +27,6 @@ func CmdLabelsRemoveRegistry() *jiracli.CommandRegistryEntry {
return CmdLabelsRemoveUsage(cmd, &opts) return CmdLabelsRemoveUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
return CmdLabelsRemove(o, globals, &opts) return CmdLabelsRemove(o, globals, &opts)
}, },
} }
+3 -5
View File
@@ -6,15 +6,14 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
type LabelsSetOptions struct { type LabelsSetOptions struct {
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"` jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
Project string `yaml:"project,omitempty" json:"project,omitempty"`
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"` Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
Labels []string `yaml:"labels,omitempty" json:"labels,omitempty"` Labels []string `yaml:"labels,omitempty" json:"labels,omitempty"`
} }
@@ -28,7 +27,6 @@ func CmdLabelsSetRegistry() *jiracli.CommandRegistryEntry {
return CmdLabelsSetUsage(cmd, &opts) return CmdLabelsSetUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
return CmdLabelsSet(o, globals, &opts) return CmdLabelsSet(o, globals, &opts)
}, },
} }
+2 -2
View File
@@ -5,8 +5,8 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
+2 -2
View File
@@ -6,8 +6,8 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
"github.com/mgutz/ansi" "github.com/mgutz/ansi"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
+2 -2
View File
@@ -6,8 +6,8 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
"github.com/mgutz/ansi" "github.com/mgutz/ansi"
"golang.org/x/crypto/ssh/terminal" "golang.org/x/crypto/ssh/terminal"
survey "gopkg.in/AlecAivazis/survey.v1" survey "gopkg.in/AlecAivazis/survey.v1"
+3 -6
View File
@@ -6,15 +6,14 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
type RankOptions struct { type RankOptions struct {
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"` jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
Project string `yaml:"project,omitempty" json:"project,omitempty"`
First string `yaml:"first,omitempty" json:"first,omitempty"` First string `yaml:"first,omitempty" json:"first,omitempty"`
Second string `yaml:"second,omitempty" json:"second,omitempty"` Second string `yaml:"second,omitempty" json:"second,omitempty"`
Order string `yaml:"order,omitempty" json:"order,omitempty"` Order string `yaml:"order,omitempty" json:"order,omitempty"`
@@ -30,8 +29,6 @@ func CmdRankRegistry() *jiracli.CommandRegistryEntry {
return CmdRankUsage(cmd, &opts) return CmdRankUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { 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) return CmdRank(o, globals, &opts)
}, },
} }
+1 -1
View File
@@ -1,6 +1,6 @@
package jiracmd package jiracmd
import "github.com/Kuchenm0nster/jira/jiracli" import "github.com/go-jira/jira/jiracli"
func RegisterAllCommands() { func RegisterAllCommands() {
jiracli.RegisterCommand(jiracli.CommandRegistry{Command: "acknowledge", Entry: CmdTransitionRegistry("acknowledge"), Aliases: []string{"ack"}}) jiracli.RegisterCommand(jiracli.CommandRegistry{Command: "acknowledge", Entry: CmdTransitionRegistry("acknowledge"), Aliases: []string{"ack"}})
+1 -1
View File
@@ -9,7 +9,7 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
+2 -2
View File
@@ -5,8 +5,8 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
yaml "gopkg.in/coryb/yaml.v2" yaml "gopkg.in/coryb/yaml.v2"
) )
+3 -4
View File
@@ -6,9 +6,9 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
@@ -36,7 +36,6 @@ func CmdSubtaskRegistry() *jiracli.CommandRegistryEntry {
return CmdSubtaskUsage(cmd, &opts) return CmdSubtaskUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
if opts.IssueType == "" { if opts.IssueType == "" {
opts.IssueType = "Sub-task" opts.IssueType = "Sub-task"
} }
+1 -2
View File
@@ -3,7 +3,7 @@ package jiracmd
import ( import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
@@ -17,7 +17,6 @@ func CmdTakeRegistry() *jiracli.CommandRegistryEntry {
return CmdAssignUsage(cmd, &opts) return CmdAssignUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
if opts.Assignee == "" { if opts.Assignee == "" {
opts.Assignee = globals.User.Value opts.Assignee = globals.User.Value
} }
+3 -5
View File
@@ -7,15 +7,14 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
type TransitionOptions struct { type TransitionOptions struct {
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"` 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"` Overrides map[string]string `yaml:"overrides,omitempty" json:"overrides,omitempty"`
Transition string `yaml:"transition,omitempty" json:"transition,omitempty"` Transition string `yaml:"transition,omitempty" json:"transition,omitempty"`
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"` Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
@@ -46,7 +45,6 @@ func CmdTransitionRegistry(transition string) *jiracli.CommandRegistryEntry {
return CmdTransitionUsage(cmd, &opts) return CmdTransitionUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
return CmdTransition(o, globals, &opts) return CmdTransition(o, globals, &opts)
}, },
} }
+2 -4
View File
@@ -3,14 +3,13 @@ package jiracmd
import ( import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
type TransitionsOptions struct { type TransitionsOptions struct {
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"` jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
Project string `yaml:"project,omitempty" json:"project,omitempty"`
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"` Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
} }
@@ -28,7 +27,6 @@ func CmdTransitionsRegistry(defaultTemplate string) *jiracli.CommandRegistryEntr
return CmdTransitionsUsage(cmd, &opts) return CmdTransitionsUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
return CmdTransitions(o, globals, &opts) return CmdTransitions(o, globals, &opts)
}, },
} }
+1 -2
View File
@@ -3,7 +3,7 @@ package jiracmd
import ( import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
@@ -17,7 +17,6 @@ func CmdUnassignRegistry() *jiracli.CommandRegistryEntry {
return CmdAssignUsage(cmd, &opts) return CmdAssignUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
return CmdAssign(o, globals, &opts) return CmdAssign(o, globals, &opts)
}, },
} }
+1 -1
View File
@@ -9,7 +9,7 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
+2 -4
View File
@@ -3,15 +3,14 @@ package jiracmd
import ( import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
type ViewOptions struct { type ViewOptions struct {
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"` jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
jira.IssueOptions `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"` Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
} }
@@ -29,7 +28,6 @@ func CmdViewRegistry() *jiracli.CommandRegistryEntry {
return CmdViewUsage(cmd, &opts) return CmdViewUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
return CmdView(o, globals, &opts) return CmdView(o, globals, &opts)
}, },
} }
+2 -4
View File
@@ -6,8 +6,8 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
@@ -20,7 +20,6 @@ const (
type VoteOptions struct { type VoteOptions struct {
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"` jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
Project string `yaml:"project,omitempty" json:"project,omitempty"`
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"` Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
Action VoteAction `yaml:"-" json:"-"` Action VoteAction `yaml:"-" json:"-"`
} }
@@ -38,7 +37,6 @@ func CmdVoteRegistry() *jiracli.CommandRegistryEntry {
return CmdVoteUsage(cmd, &opts) return CmdVoteUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
return CmdVote(o, globals, &opts) return CmdVote(o, globals, &opts)
}, },
} }
+2 -4
View File
@@ -6,8 +6,8 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
@@ -20,7 +20,6 @@ const (
type WatchOptions struct { type WatchOptions struct {
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"` jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
Project string `yaml:"project,omitempty" json:"project,omitempty"`
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"` Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
Watcher string `yaml:"watcher,omitempty" json:"watcher,omitempty"` Watcher string `yaml:"watcher,omitempty" json:"watcher,omitempty"`
Action WatchAction `yaml:"-" json:"-"` Action WatchAction `yaml:"-" json:"-"`
@@ -39,7 +38,6 @@ func CmdWatchRegistry() *jiracli.CommandRegistryEntry {
return CmdWatchUsage(cmd, &opts) return CmdWatchUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
return CmdWatch(o, globals, &opts) return CmdWatch(o, globals, &opts)
}, },
} }
+3 -5
View File
@@ -5,16 +5,15 @@ import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
type WorklogAddOptions struct { type WorklogAddOptions struct {
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"` jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
jiradata.Worklog `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"` Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
} }
@@ -31,7 +30,6 @@ func CmdWorklogAddRegistry() *jiracli.CommandRegistryEntry {
return CmdWorklogAddUsage(cmd, &opts) return CmdWorklogAddUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
return CmdWorklogAdd(o, globals, &opts) return CmdWorklogAdd(o, globals, &opts)
}, },
} }
+3 -5
View File
@@ -3,15 +3,14 @@ package jiracmd
import ( import (
"github.com/coryb/figtree" "github.com/coryb/figtree"
"github.com/coryb/oreo" "github.com/coryb/oreo"
"github.com/Kuchenm0nster/jira" "github.com/go-jira/jira"
"github.com/Kuchenm0nster/jira/jiracli" "github.com/go-jira/jira/jiracli"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
) )
type WorklogListOptions struct { type WorklogListOptions struct {
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"` jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
Project string `yaml:"project,omitempty" json:"project,omitempty"`
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"` Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
} }
@@ -28,7 +27,6 @@ func CmdWorklogListRegistry() *jiracli.CommandRegistryEntry {
return CmdWorklogListUsage(cmd, &opts) return CmdWorklogListUsage(cmd, &opts)
}, },
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
return CmdWorklogList(o, globals, &opts) return CmdWorklogList(o, globals, &opts)
}, },
} }
+1 -8
View File
@@ -9,17 +9,10 @@ import (
// or nil // or nil
func (t Transitions) Find(name string) *Transition { func (t Transitions) Find(name string) *Transition {
name = strings.ToLower(name) name = strings.ToLower(name)
matches := Transitions{}
for _, trans := range t { for _, trans := range t {
if strings.ToLower(trans.Name) == name { if strings.Contains(strings.ToLower(trans.Name), name) {
return trans return trans
} }
if strings.Contains(strings.ToLower(trans.Name), name) {
matches = append(matches, trans)
}
}
if len(matches) > 0 {
return matches[0]
} }
return nil return nil
} }
+1 -21
View File
@@ -3,7 +3,7 @@ package jira
import ( import (
"encoding/json" "encoding/json"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
) )
// https://docs.atlassian.com/jira/REST/cloud/#api/2/project-getProjectComponents // https://docs.atlassian.com/jira/REST/cloud/#api/2/project-getProjectComponents
@@ -25,23 +25,3 @@ func GetProjectComponents(ua HttpClient, endpoint string, project string) (*jira
} }
return nil, responseError(resp) 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 nil, responseError(resp)
}
-63
View File
@@ -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
}
}
}
+21
View File
@@ -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
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
) )
type SearchProvider interface { type SearchProvider interface {
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"github.com/Kuchenm0nster/jira/jiradata" "github.com/go-jira/jira/jiradata"
) )
type AuthProvider interface { type AuthProvider interface {