mirror of
https://github.com/Threnklyn/jira.git
synced 2026-06-10 14:53:32 +02:00
Compare commits
346 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 748b7d552f | |||
| bf988a00b4 | |||
| f50f3d2b16 | |||
| 4263bd24f9 | |||
| f922fc7fb7 | |||
| a5358286b2 | |||
| e3f29d4884 | |||
| 10ad221ce4 | |||
| 6e90b2000a | |||
| 07bd89afca | |||
| b3723c7b63 | |||
| 80adab38ee | |||
| ccb5fadfc3 | |||
| fedc66614f | |||
| a59fdc81fc | |||
| 892bedc8a2 | |||
| 29b5dda228 | |||
| f16109e038 | |||
| f089cd51f2 | |||
| 70e91a94b5 | |||
| 298a637f8c | |||
| 7f1a21fd5c | |||
| c32908a6ff | |||
| 1c55c069d3 | |||
| 2c7a9b2830 | |||
| f7587f43f1 | |||
| 0e3082fab6 | |||
| 6fbc522ee7 | |||
| c2abbd9864 | |||
| c3d22b765a | |||
| 96ec3339a4 | |||
| 31f7b03978 | |||
| 578c44c628 | |||
| aa8dae7c5b | |||
| a8c961fe19 | |||
| 42e5d23f63 | |||
| b572037cfe | |||
| ff5decc114 | |||
| 1d27af0a2c | |||
| 7179f36e5f | |||
| a1450e879f | |||
| 7da5f353ac | |||
| 18e2c1d5b7 | |||
| c6ef367e89 | |||
| 4bf1d030e7 | |||
| d093bcf63a | |||
| 3bc5e42bd0 | |||
| 3c1c4d95e1 | |||
| 6a27e28c61 | |||
| 36e2a914cd | |||
| 97591ef200 | |||
| 5c93c4e8d7 | |||
| a9dd1ed310 | |||
| af7a8f45e4 | |||
| a311d0d817 | |||
| 01c0c38d8c | |||
| 417568ca2d | |||
| fae004391a | |||
| a26683e01d | |||
| 57e1c7426e | |||
| 7e9746304a | |||
| 7cd34d3698 | |||
| f5871c5a58 | |||
| 01bdea9778 | |||
| d6173ce77d | |||
| e26fbfcb14 | |||
| b590005aac | |||
| d002d7fe74 | |||
| 789886c68e | |||
| 8a462152ea | |||
| 9cbd9937be | |||
| db53622548 | |||
| 0f059a5ed1 | |||
| 659a5c8e74 | |||
| 590244947b | |||
| 6e87b646ff | |||
| b045cd74c2 | |||
| 3339303e89 | |||
| 3c0a62e74f | |||
| 967602392f | |||
| 568f0be821 | |||
| 719f7a68a7 | |||
| 979910f8dd | |||
| 90f01ce60a | |||
| 2c9d957304 | |||
| 4445255914 | |||
| a13b046fad | |||
| 997b6e1f24 | |||
| 8ede63c37e | |||
| 62ccffaf05 | |||
| 2062dffc60 | |||
| 435747f152 | |||
| d343852592 | |||
| 22c72f2351 | |||
| a057957086 | |||
| 3333859bf0 | |||
| 8b56ee9fb9 | |||
| a467a5c5e5 | |||
| 0d7d4dc4b8 | |||
| ba7cc13145 | |||
| 3984d0d484 | |||
| 0037a21a95 | |||
| b99dfbfbf6 | |||
| 8e4245e5bb | |||
| bb9790f287 | |||
| 17003717d9 | |||
| dc9a9de165 | |||
| 30998cbb18 | |||
| 89fe2ecf16 | |||
| 8994b42f71 | |||
| 80743e4da8 | |||
| 9f46c8499d | |||
| bca064be1f | |||
| 48c15e2daa | |||
| 3cf2e56e1f | |||
| c270f20d21 | |||
| a6bf26052c | |||
| 954a97eca3 | |||
| dd6901b2cd | |||
| 9186205b9e | |||
| 78c66dba6f | |||
| 87112c0f98 | |||
| 94dd489a10 | |||
| 050a2b4819 | |||
| d3b3c03f90 | |||
| a70384b03b | |||
| a646f76b1f | |||
| 9bb0ff379d | |||
| 0726101762 | |||
| 2d13725ccf | |||
| 490a47db43 | |||
| 396ae5fb6a | |||
| ff12f26f81 | |||
| 7424ebc606 | |||
| 85de83a6e2 | |||
| fc5be16ac6 | |||
| 000a923189 | |||
| d5e4ce3df1 | |||
| 7320d4afef | |||
| 3ecca6895d | |||
| 0e520a49ae | |||
| 27f57b2bbe | |||
| 71aaa88b13 | |||
| 52a577ea48 | |||
| 027adeef46 | |||
| b8e73a5cb0 | |||
| 43e07f1197 | |||
| 957696bed8 | |||
| 225e1dcc05 | |||
| f1390760b4 | |||
| 31c113d1ba | |||
| 9bcdcc128f | |||
| 098d963881 | |||
| 9b9186f7d4 | |||
| f125ef3fa9 | |||
| 5cc009af4c | |||
| d237e86cda | |||
| 664c5cad24 | |||
| 36c99ce040 | |||
| 58a300422b | |||
| eb90676bbc | |||
| d54a549d24 | |||
| 3d00c294f4 | |||
| 181bd74f1b | |||
| f6809e32f4 | |||
| cbcac1755a | |||
| 890b9aa724 | |||
| 76dd1d8982 | |||
| 271289a3c9 | |||
| d8189f0a01 | |||
| 23ac11872b | |||
| 410df68354 | |||
| aaa72012a7 | |||
| 514c1491c7 | |||
| 9258d4df15 | |||
| ee69afadd0 | |||
| a87bdf4038 | |||
| 68c2588153 | |||
| 0cba806942 | |||
| df9dbe65b4 | |||
| 492754f059 | |||
| 97d8c5f6e0 | |||
| 1e619ea690 | |||
| b7d8a9c324 | |||
| 8b717de870 | |||
| f5921077ca | |||
| c9a4e30606 | |||
| ef9b731bac | |||
| 62303ed81b | |||
| 7191c7751b | |||
| d16bcc2f51 | |||
| 07ba74b34a | |||
| 462ef1c485 | |||
| eead13aef1 | |||
| 213a7e04af | |||
| 49e44670d9 | |||
| 5503e53168 | |||
| 9ebd2cd64e | |||
| 84b6155b0d | |||
| c23ad75957 | |||
| 3c478004d2 | |||
| ed42ef920a | |||
| fa01ff5c46 | |||
| b98da3612d | |||
| 7f9595cf15 | |||
| 09584981b6 | |||
| 1bc6b55b85 | |||
| d787ac030c | |||
| 09a61c3ea1 | |||
| 64ce3812a6 | |||
| 9146346e2f | |||
| e639cce9af | |||
| 06b26c9e00 | |||
| ac39f9ae1d | |||
| bd3cf994b8 | |||
| 91059b3578 | |||
| 4b9873b323 | |||
| cd106df78a | |||
| 50b5360cfe | |||
| 359bec2fdf | |||
| 79c83f6911 | |||
| 585382eaea | |||
| 9c818d427c | |||
| 8621d9e698 | |||
| 5610707c30 | |||
| 0b4e16a35d | |||
| 57bc97a378 | |||
| 2d02cf8132 | |||
| 18a687e78a | |||
| 5d058536d2 | |||
| d4153be0ec | |||
| edb06621f8 | |||
| 161a68920d | |||
| fd30bc1392 | |||
| 84f77be87c | |||
| dea794f037 | |||
| 43ebc846b1 | |||
| 0d7c1a7931 | |||
| 80325a5955 | |||
| 20a9666fcd | |||
| 4ae760f18f | |||
| 6da9974380 | |||
| 8c7ca383f6 | |||
| 425fa63d33 | |||
| 464742c9ba | |||
| 7fbd87289f | |||
| d400b58019 | |||
| d4a3af862d | |||
| 042bc48649 | |||
| a2e36e808a | |||
| 84bd64a188 | |||
| efbd1dd96d | |||
| ff985f910b | |||
| 9597f9b56f | |||
| 66c069e3b4 | |||
| 14189c197b | |||
| c9b5054cde | |||
| f23b1c4370 | |||
| 6c742dad0a | |||
| 3966defc53 | |||
| 794f8dd259 | |||
| 41d1a7c9a1 | |||
| 90007771bf | |||
| 7bfa241547 | |||
| e6600cf1a5 | |||
| 2e608207cb | |||
| bc1b994019 | |||
| fd399d817e | |||
| f7b587ee91 | |||
| de69971c1c | |||
| 2f9b8bb5c1 | |||
| 093c510ca2 | |||
| d3e294e1ce | |||
| 4ed8edbd19 | |||
| 28d92eb659 | |||
| d16db04e58 | |||
| 4d74554300 | |||
| 172793ea69 | |||
| dc504de271 | |||
| 986cc78ed5 | |||
| 3913726991 | |||
| 0ba8aa035b | |||
| 098eb99ed6 | |||
| 2ddaed2c29 | |||
| 9a62d1a553 | |||
| 74d7287589 | |||
| c6e4b3dc0e | |||
| 8b5e7b7568 | |||
| 4dea068113 | |||
| 28e4554fe3 | |||
| 065f9c8d77 | |||
| 9f433acaa0 | |||
| e4c10be811 | |||
| 4c6b36c83a | |||
| a8eaa97de1 | |||
| cd3cfd820f | |||
| a04c3a4c61 | |||
| bb66e58dfd | |||
| e21f18e987 | |||
| 96bbbd7ce3 | |||
| 3e8b9bd9f5 | |||
| 8fe0d98d54 | |||
| 1a3eaf340c | |||
| 96b4658dcb | |||
| c9d8dfbe55 | |||
| 238e16fc09 | |||
| 22a354ce42 | |||
| d9736919bb | |||
| 3c16e1754a | |||
| 650bc4b50d | |||
| b1c9bf5ae5 | |||
| 66eb7bff38 | |||
| abc82b909e | |||
| dabf4cf034 | |||
| 79a6381307 | |||
| 893454fc69 | |||
| d5b9631cf4 | |||
| e841270b83 | |||
| 2ededeeaf7 | |||
| 00cba793ad | |||
| fb43753c31 | |||
| 5085a14494 | |||
| 5da04c1f86 | |||
| 052e038d73 | |||
| a7f1323f34 | |||
| 8d27b736ca | |||
| c3c008e53d | |||
| 608e586d1c | |||
| 2c552ac530 | |||
| 1d269183c3 | |||
| e0e1e5b941 | |||
| 941824d7f8 | |||
| c585244f3e | |||
| 29b95a52cb | |||
| f556375242 | |||
| 86b963bdb5 | |||
| 036ebb4bf7 | |||
| 7d481fe965 | |||
| 4709bbbe38 | |||
| 1c79a80389 | |||
| 6a879959be | |||
| d46f9495e7 | |||
| e6faee1573 | |||
| c4be59cae3 | |||
| 9cc91f7108 | |||
| da8ee59ebb |
Executable
+60
@@ -0,0 +1,60 @@
|
|||||||
|
{{ if .Versions -}}
|
||||||
|
<a name="unreleased"></a>
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
{{ if .Unreleased.CommitGroups -}}
|
||||||
|
{{ range .Unreleased.CommitGroups -}}
|
||||||
|
### {{ .Title }}
|
||||||
|
{{ range .Commits -}}
|
||||||
|
- [{{.Hash.Short}}]({{ $.Info.RepositoryURL }}/commit/{{ .Hash.Long }}): {{ .Subject }}
|
||||||
|
{{ if .Refs -}}{{ range .Refs }} -{{if .Action}}{{ .Action }} {{ end }} [#{{ .Ref }}]({{ $.Info.RepositoryURL }}/issues/{{ .Ref }}){{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
|
||||||
|
{{ range .Versions }}
|
||||||
|
<a name="{{ .Tag.Name }}"></a>
|
||||||
|
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
|
||||||
|
{{ range .CommitGroups -}}
|
||||||
|
### {{ .Title }}
|
||||||
|
{{ range .Commits -}}
|
||||||
|
- [{{.Hash.Short}}]({{ $.Info.RepositoryURL }}/commit/{{ .Hash.Long }}): {{ .Subject }}
|
||||||
|
{{ if .Refs -}}{{ range .Refs }} - {{if .Action}}{{ .Action }}{{ end }} [#{{ .Ref }}]({{ $.Info.RepositoryURL }}/issues/{{ .Ref }}){{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
|
||||||
|
{{- if .RevertCommits -}}
|
||||||
|
### Reverts
|
||||||
|
{{ range .RevertCommits -}}
|
||||||
|
- {{ .Revert.Header }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end -}}
|
||||||
|
|
||||||
|
{{- if .MergeCommits -}}
|
||||||
|
### Pull Requests
|
||||||
|
{{ range .MergeCommits -}}
|
||||||
|
- {{ .Header }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end -}}
|
||||||
|
|
||||||
|
{{- if .NoteGroups -}}
|
||||||
|
{{ range .NoteGroups -}}
|
||||||
|
### {{ .Title }}
|
||||||
|
{{ range .Notes }}
|
||||||
|
{{ .Body }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
|
||||||
|
{{- if .Versions }}
|
||||||
|
[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
|
||||||
|
{{ range .Versions -}}
|
||||||
|
{{ if .Tag.Previous -}}
|
||||||
|
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
Executable
+29
@@ -0,0 +1,29 @@
|
|||||||
|
style: github
|
||||||
|
template: CHANGELOG.tpl.md
|
||||||
|
info:
|
||||||
|
title: CHANGELOG
|
||||||
|
repository_url: https://github.com/go-jira/go-jira
|
||||||
|
options:
|
||||||
|
commits:
|
||||||
|
sort_by: Scope
|
||||||
|
commit_groups:
|
||||||
|
group_by: Scope
|
||||||
|
header:
|
||||||
|
pattern: '^(.*):\s*(.*)$'
|
||||||
|
pattern_maps:
|
||||||
|
- Scope
|
||||||
|
- Subject
|
||||||
|
issues:
|
||||||
|
prefix:
|
||||||
|
- "#"
|
||||||
|
|
||||||
|
refs:
|
||||||
|
actions:
|
||||||
|
- Closes
|
||||||
|
- Fixes
|
||||||
|
- PullRequest
|
||||||
|
|
||||||
|
notes:
|
||||||
|
keywords:
|
||||||
|
- BREAKING CHANGE
|
||||||
|
- NOTE
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# one of these users must approve the PR before merging
|
||||||
|
* @coryb @mikepea @ldelossa @georgettica
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
tests:
|
||||||
|
name: Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: docker.io/library/golang:${{ matrix.go }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go: ['1.13', '1.14']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: add gox
|
||||||
|
run: go install github.com/mitchellh/gox
|
||||||
|
- name: make binaries
|
||||||
|
run: make all
|
||||||
|
- name: perform tests
|
||||||
|
run: go test -v ./...
|
||||||
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
---
|
||||||
|
name: Prepare Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
branch:
|
||||||
|
description: 'the branch to prepare the release against'
|
||||||
|
required: true
|
||||||
|
deault: 'master'
|
||||||
|
tag:
|
||||||
|
description: 'the tag to be released'
|
||||||
|
required: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
prepare:
|
||||||
|
name: Prepare Release
|
||||||
|
runs-on: 'ubuntu-latest'
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.event.inputs.branch }}
|
||||||
|
- name: Changelog
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
curl -L -o /tmp/git-chglog.tar.gz https://github.com/git-chglog/git-chglog/releases/download/v0.14.2/git-chglog_0.14.2_linux_amd64.tar.gz
|
||||||
|
tar xf /tmp/git-chglog.tar.gz -C /tmp git-chglog
|
||||||
|
chmod u+x /tmp/git-chglog
|
||||||
|
echo "creating change log for tag: ${{ github.event.inputs.tag }}"
|
||||||
|
/tmp/git-chglog --next-tag "${{ github.event.inputs.tag }}" -o CHANGELOG.md
|
||||||
|
- name: Create Pull Request
|
||||||
|
uses: peter-evans/create-pull-request@v3.8.2
|
||||||
|
with:
|
||||||
|
title: "${{ github.event.inputs.tag }} Changelog Bump"
|
||||||
|
body: "This is an automated changelog commit."
|
||||||
|
commit-message: "chore: ${{ github.event.inputs.tag }} changelog bump"
|
||||||
|
branch: "ready-${{ github.event.inputs.tag }}"
|
||||||
|
signoff: "gh-actions"
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
---
|
||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- v1.*
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
name: Release
|
||||||
|
runs-on: 'ubuntu-latest'
|
||||||
|
container: docker.io/library/golang:1.14
|
||||||
|
steps:
|
||||||
|
# This step is for local testing using https://github.com/nektos/act
|
||||||
|
- name: install node
|
||||||
|
run: |
|
||||||
|
apt update
|
||||||
|
apt install -y nodejs
|
||||||
|
- name: Setup
|
||||||
|
run: |
|
||||||
|
tag=`basename ${{ github.ref }}`
|
||||||
|
echo "VERSION=${tag}" >> $GITHUB_ENV
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: add gox
|
||||||
|
run: go install github.com/mitchellh/gox
|
||||||
|
- name: ChangeLog
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
curl -o git-chglog -L https://github.com/git-chglog/git-chglog/releases/download/0.9.1/git-chglog_linux_amd64
|
||||||
|
chmod u+x git-chglog
|
||||||
|
tag=`basename ${{ github.ref }}`
|
||||||
|
echo "creating change log for tag: $tag"
|
||||||
|
chglog="$(./git-chglog ${tag})"
|
||||||
|
chglog="${chglog//'%'/'%25'}"
|
||||||
|
chglog="${chglog//$'\n'/'%0A'}"
|
||||||
|
chglog="${chglog//$'\r'/'%0D'}"
|
||||||
|
echo "CHANGELOG=${chglog}" >> $GITHUB_ENV
|
||||||
|
- name: Create Release
|
||||||
|
id: create_release
|
||||||
|
uses: actions/create-release@latest
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
tag_name: ${{ github.ref }}
|
||||||
|
release_name: ${{ env.VERSION }} Release
|
||||||
|
body: |
|
||||||
|
${{ env.CHANGELOG }}
|
||||||
|
prerelease: ${{ contains(env.VERSION, 'alpha') || contains(env.VERSION, 'beta') || contains(env.VERSION, 'rc') }}
|
||||||
|
# perform production release of artifacts
|
||||||
|
- name: Build Artifacts
|
||||||
|
run: |
|
||||||
|
VERSION=${{ env.VERSION }} make all
|
||||||
|
- name: "Publish Darwin AMD64"
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ./dist/github.com/go-jira/jira-darwin-amd64
|
||||||
|
asset_name: jira-darwin-amd64
|
||||||
|
asset_content_type: application/octet-stream
|
||||||
|
- name: "Publish Linux 386"
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ./dist/github.com/go-jira/jira-linux-386
|
||||||
|
asset_name: jira-linux-386
|
||||||
|
asset_content_type: application/octet-stream
|
||||||
|
- name: "Publish Linux AMD64"
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ./dist/github.com/go-jira/jira-linux-amd64
|
||||||
|
asset_name: jira-linux-amd64
|
||||||
|
asset_content_type: application/octet-stream
|
||||||
|
- name: "Publish Windows 386"
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ./dist/github.com/go-jira/jira-windows-386.exe
|
||||||
|
asset_name: jira-windows-386.exe
|
||||||
|
asset_content_type: application/octet-stream
|
||||||
|
- name: "Publish Windows AMD64"
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ./dist/github.com/go-jira/jira-windows-amd64.exe
|
||||||
|
asset_name: jira-windows-amd64.exe
|
||||||
|
asset_content_type: application/octet-stream
|
||||||
|
|
||||||
|
|
||||||
+10
-2
@@ -1,4 +1,12 @@
|
|||||||
jira
|
jira
|
||||||
schemas/*.json
|
schemas/*.json
|
||||||
t/.gnupg/random_seed
|
/_t/.gnupg/random_seed
|
||||||
t/issue.props
|
/_t/issue.props
|
||||||
|
/_t/attach.props
|
||||||
|
/_t/garbage.bin
|
||||||
|
/_t/attach1.txt
|
||||||
|
/_t/binary.out
|
||||||
|
/_t/foobar.bin
|
||||||
|
/_t/.password-store/GoJira/api-token:gojira@corybennett.org.gpg
|
||||||
|
/_t/.password-store/GoJira/api-token:mothra@corybennett.org.gpg
|
||||||
|
dist
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
config:
|
||||||
|
stop: true
|
||||||
|
password-source: pass
|
||||||
|
endpoint: https://go-jira.atlassian.net
|
||||||
|
user: admin
|
||||||
|
login: atlassian@corybennett.org
|
||||||
|
|
||||||
|
queries:
|
||||||
|
todo: |
|
||||||
|
resolution = unresolved {{if .project}}AND project = '{{.project}}'{{end}} AND status = 'To Do'
|
||||||
|
open: |
|
||||||
|
resolution = unresolved {{if .project}}AND project = '{{.project}}'{{end}} AND status = 'Open'
|
||||||
-16
@@ -1,16 +0,0 @@
|
|||||||
sudo: true
|
|
||||||
before_install:
|
|
||||||
- sudo apt-get update && sudo apt-get install -y pass gnupg
|
|
||||||
|
|
||||||
language: go
|
|
||||||
go_import_path: gopkg.in/Netflix-Skunkworks/go-jira.v1
|
|
||||||
go:
|
|
||||||
- 1.8
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
fast_finish: true
|
|
||||||
|
|
||||||
script:
|
|
||||||
- make vet
|
|
||||||
- make
|
|
||||||
- make prove 2>&1
|
|
||||||
+462
-240
@@ -1,291 +1,513 @@
|
|||||||
# Changelog
|
<a name="unreleased"></a>
|
||||||
|
## [Unreleased]
|
||||||
## 1.0.2 - 2017-09-06
|
|
||||||
|
|
||||||
* update dependencies [Cory Bennett] [[aa876cd](https://github.com/Netflix-Skunkworks/go-jira/commit/aa876cd)]
|
<a name="v1.0.28"></a>
|
||||||
* update for github.com/AlecAivazis/survey => gopkg.in/AlecAivazis/survey.v1 package [Cory Bennett] [[9453179](https://github.com/Netflix-Skunkworks/go-jira/commit/9453179)]
|
## [v1.0.28] - 2021-05-05
|
||||||
* use stdout to determin output terminal size [Cory Bennett] [[4d79af4](https://github.com/Netflix-Skunkworks/go-jira/commit/4d79af4)]
|
|
||||||
|
<a name="v1.0.27"></a>
|
||||||
## 1.0.1 - 2017-09-06
|
## [v1.0.27] - 2020-10-01
|
||||||
|
### Block
|
||||||
* [[#13](https://github.com/Netflix-Skunkworks/go-jira/issues/13)] change default input syntax to not require escaping for special characters [Cory Bennett] [[1106558](https://github.com/Netflix-Skunkworks/go-jira/commit/1106558)]
|
- [f7587f4](https://github.com/go-jira/go-jira/commit/f7587f43f12bcf0b47e52a5abe775daf6cbb3229): reverse order of arguments
|
||||||
|
### Chore
|
||||||
## 1.0.0 - 2017-09-05
|
- [2c7a9b2](https://github.com/go-jira/go-jira/commit/2c7a9b283025202428db629b1a9ecdc63a9b704f): V1.0.27 changelog bump
|
||||||
|
### Templates
|
||||||
* fix build for windows [Cory Bennett] [[1b854da](https://github.com/Netflix-Skunkworks/go-jira/commit/1b854da)]
|
- [0e3082f](https://github.com/go-jira/go-jira/commit/0e3082fab6e12a337f5fe26c3e2dec5cb51425d8): add wrap helper function
|
||||||
* change the default log output format [Cory Bennett] [[f1b8c64](https://github.com/Netflix-Skunkworks/go-jira/commit/f1b8c64)]
|
|
||||||
* tweak auto-login so it does not print the standard `jira login` command output [Cory Bennett] [[49f6cdc](https://github.com/Netflix-Skunkworks/go-jira/commit/49f6cdc)]
|
<a name="v1.0.26"></a>
|
||||||
* add --quiet global option [Cory Bennett] [[c226077](https://github.com/Netflix-Skunkworks/go-jira/commit/c226077)]
|
## [v1.0.26] - 2020-09-11
|
||||||
* refactor to allow for --insecure and --unixproxy arguments [Cory Bennett] [[c0358eb](https://github.com/Netflix-Skunkworks/go-jira/commit/c0358eb)]
|
### Chore
|
||||||
* handle html response on expired cookies (require X-Ausername header to always be present) [Cory Bennett] [[21920c5](https://github.com/Netflix-Skunkworks/go-jira/commit/21920c5)]
|
- [c3d22b7](https://github.com/go-jira/go-jira/commit/c3d22b765a6f3cd93445033da5c19fc0feaeaece): v1.0.26 changelog bump
|
||||||
* allow login prompt to be interrupted [Cory Bennett] [[7ab6c22](https://github.com/Netflix-Skunkworks/go-jira/commit/7ab6c22)]
|
### Cicd
|
||||||
* fmt -> log typo [Cory Bennett] [[bccf09f](https://github.com/Netflix-Skunkworks/go-jira/commit/bccf09f)]
|
- [96ec333](https://github.com/go-jira/go-jira/commit/96ec3339a4cc810da20450a9d9e91612c2b9aad4): automated releases fixes
|
||||||
* make ~/.jira.d directory if not already present [Cory Bennett] [[e72479c](https://github.com/Netflix-Skunkworks/go-jira/commit/e72479c)]
|
- [31f7b03](https://github.com/go-jira/go-jira/commit/31f7b0397890388947f2312cf42af494c7a6979f): automated changelog and release
|
||||||
* fix go vet [Cory Bennett] [[e04b506](https://github.com/Netflix-Skunkworks/go-jira/commit/e04b506)]
|
|
||||||
* fix tests [Cory Bennett] [[ba35f55](https://github.com/Netflix-Skunkworks/go-jira/commit/ba35f55)]
|
<a name="v1.0.25"></a>
|
||||||
* add OK printf [Cory Bennett] [[dc02181](https://github.com/Netflix-Skunkworks/go-jira/commit/dc02181)]
|
## [v1.0.25] - 2020-09-11
|
||||||
* change --method to use -M for backwards compat [Cory Bennett] [[b120c0b](https://github.com/Netflix-Skunkworks/go-jira/commit/b120c0b)]
|
### Bugfix
|
||||||
* add resolution to dup'd issues when necessary [Cory Bennett] [[2638396](https://github.com/Netflix-Skunkworks/go-jira/commit/2638396)]
|
- [aa8dae7](https://github.com/go-jira/go-jira/commit/aa8dae7c5b7035e086bd60b3d354ffa43c30caf7): only build jira tool with gox
|
||||||
* call correct function for `labels remove|set` commands [Cory Bennett] [[ad1a62a](https://github.com/Netflix-Skunkworks/go-jira/commit/ad1a62a)]
|
### Chore
|
||||||
* data argument is optional (for GET and DELETE requests) [Cory Bennett] [[4b60313](https://github.com/Netflix-Skunkworks/go-jira/commit/4b60313)]
|
- [578c44c](https://github.com/go-jira/go-jira/commit/578c44c628e3134e4d46f3250baf46d6b054cfe8): v1.0.25 release
|
||||||
* fix usage, overrides not serialized correctly [Cory Bennett] [[84119a2](https://github.com/Netflix-Skunkworks/go-jira/commit/84119a2)]
|
### Fix(Changelog)
|
||||||
* fix `jira ISSUE-123` command line parsing [Cory Bennett] [[fa4ac25](https://github.com/Netflix-Skunkworks/go-jira/commit/fa4ac25)]
|
- [ff5decc](https://github.com/go-jira/go-jira/commit/ff5decc114b297e9b393f8d4af72bbace0037c73): fix changelog version
|
||||||
* add logger object to jiracmd [Cory Bennett] [[aed952b](https://github.com/Netflix-Skunkworks/go-jira/commit/aed952b)]
|
### Tests
|
||||||
* refactor for GlobalOptions and CommonOptions [Cory Bennett] [[979da1f](https://github.com/Netflix-Skunkworks/go-jira/commit/979da1f)]
|
- [a8c961f](https://github.com/go-jira/go-jira/commit/a8c961fe19f424df3fdbe108a374cc56b8ff9fe0): rework passive tests into native go tests
|
||||||
* move commands from jiracli package to jiracmd package [Cory Bennett] [[0a5510b](https://github.com/Netflix-Skunkworks/go-jira/commit/0a5510b)]
|
|
||||||
* use jiracli.Error object to disambiguate between kingpin errors and cli errors [Cory Bennett] [[fb1bfeb](https://github.com/Netflix-Skunkworks/go-jira/commit/fb1bfeb)]
|
<a name="v1.0.24"></a>
|
||||||
* fix stray newline for list table template [Cory Bennett] [[36c26c5](https://github.com/Netflix-Skunkworks/go-jira/commit/36c26c5)]
|
## [v1.0.24] - 2020-09-04
|
||||||
* fix dynamic table output when not on tty [Cory Bennett] [[3942f6f](https://github.com/Netflix-Skunkworks/go-jira/commit/3942f6f)]
|
### Cicd
|
||||||
* when using --verbose set the JIRA_DEBUG environment variable so custom-commands can auto enable verbose output [Cory Bennett] [[da9a2b2](https://github.com/Netflix-Skunkworks/go-jira/commit/da9a2b2)]
|
- [d093bcf](https://github.com/go-jira/go-jira/commit/d093bcf63adbd1d4e88640307aa8a5c8669ac535): deflake tests
|
||||||
* make `jira ISSUE-123` usage call `jira view ISSUE-123` [Cory Bennett] [[ec0858b](https://github.com/Netflix-Skunkworks/go-jira/commit/ec0858b)]
|
### Tests
|
||||||
* integrate kingpeon library to allow for custom commands via configuration [Cory Bennett] [[301a61f](https://github.com/Netflix-Skunkworks/go-jira/commit/301a61f)]
|
- [3bc5e42](https://github.com/go-jira/go-jira/commit/3bc5e42bd0186dbc5c47f022b9528207140fa297): transition if under review
|
||||||
* use terminal width to adjust list table output [Cory Bennett] [[2a081dd](https://github.com/Netflix-Skunkworks/go-jira/commit/2a081dd)]
|
### Transition
|
||||||
* set yaml/json tags for option structs [Cory Bennett] [[f52d2c4](https://github.com/Netflix-Skunkworks/go-jira/commit/f52d2c4)]
|
- [3c1c4d9](https://github.com/go-jira/go-jira/commit/3c1c4d95e199a717499f1f4259649152a6832e9f): map field name to id
|
||||||
* update generated data files [Cory Bennett] [[c89f11d](https://github.com/Netflix-Skunkworks/go-jira/commit/c89f11d)]
|
### Username-Deprecation
|
||||||
* automatically login when anonymous user detected [Cory Bennett] [[21add54](https://github.com/Netflix-Skunkworks/go-jira/commit/21add54)]
|
- [6a27e28](https://github.com/go-jira/go-jira/commit/6a27e28c61c45f4b2a6aff473cf28852a2df64a2): use email and display names
|
||||||
* refactor trivial objects in favor of arguments to static functions [Cory Bennett] [[1f345ce](https://github.com/Netflix-Skunkworks/go-jira/commit/1f345ce)]
|
### Pull Requests
|
||||||
* set JIRA_OPERATION when parsing configs. Use figtree config types for options to make defaulting work [Cory Bennett] [[5716a7c](https://github.com/Netflix-Skunkworks/go-jira/commit/5716a7c)]
|
- Merge pull request [#367](https://github.com/go-jira/go-jira/issues/367) from bbkane/master
|
||||||
* add better handing for usage error [Cory Bennett] [[b235dcc](https://github.com/Netflix-Skunkworks/go-jira/commit/b235dcc)]
|
- Merge pull request [#349](https://github.com/go-jira/go-jira/issues/349) from aszenz/patch-1
|
||||||
* adding `request` command, removing dead code [Cory Bennett] [[56b1c9d](https://github.com/Netflix-Skunkworks/go-jira/commit/56b1c9d)]
|
- Merge pull request [#355](https://github.com/go-jira/go-jira/issues/355) from go-jira/vanniktech-patch-1
|
||||||
* adding Do required for request language [Cory Bennett] [[a1c2849](https://github.com/Netflix-Skunkworks/go-jira/commit/a1c2849)]
|
- Merge pull request [#323](https://github.com/go-jira/go-jira/issues/323) from tjamet/issue-comment
|
||||||
* add `browse` command and implement -b option for most operations [Cory Bennett] [[a91b9d5](https://github.com/Netflix-Skunkworks/go-jira/commit/a91b9d5)]
|
|
||||||
* fix IssueAssign [Cory Bennett] [[f32cc70](https://github.com/Netflix-Skunkworks/go-jira/commit/f32cc70)]
|
|
||||||
* merge in update for upstream changes [#104](https://github.com/Netflix-Skunkworks/go-jira/issues/104) [Cory Bennett] [[19d8686](https://github.com/Netflix-Skunkworks/go-jira/commit/19d8686)]
|
<a name="v1.0.23"></a>
|
||||||
* add `export-templates` command [Cory Bennett] [[abaad56](https://github.com/Netflix-Skunkworks/go-jira/commit/abaad56)]
|
## [v1.0.23] - 2020-02-26
|
||||||
* add `issuetypes` command [Cory Bennett] [[da39323](https://github.com/Netflix-Skunkworks/go-jira/commit/da39323)]
|
### Add Sprig Template Functions, Replaces [#215] Http
|
||||||
* add `components` command [Cory Bennett] [[0bd3ca2](https://github.com/Netflix-Skunkworks/go-jira/commit/0bd3ca2)]
|
- [719f7a6](https://github.com/go-jira/go-jira/commit/719f7a68a7f2c01e428a1ad3519a611c92268d27): //masterminds.github.io/sprig/
|
||||||
* add `component add` command [Cory Bennett] [[cc90610](https://github.com/Netflix-Skunkworks/go-jira/commit/cc90610)]
|
- [#215](https://github.com/go-jira/go-jira/issues/215)### All
|
||||||
* add `take`, `unassign` and `assign|give` commands [Cory Bennett] [[959524a](https://github.com/Netflix-Skunkworks/go-jira/commit/959524a)]
|
- [31c113d](https://github.com/go-jira/go-jira/commit/31c113d1baf2dba814bca3e1dcc519ab8b0269e9): unindent some code
|
||||||
* adding `labels [add|set|remove]` commands [Cory Bennett] [[9161861](https://github.com/Netflix-Skunkworks/go-jira/commit/9161861)]
|
- [f125ef3](https://github.com/go-jira/go-jira/commit/f125ef3fa9c7a64e8dfda9a643cadf0241b09bc7): convert to a Go module
|
||||||
* add `comment` command [Cory Bennett] [[f0b08c5](https://github.com/Netflix-Skunkworks/go-jira/commit/f0b08c5)]
|
### CI
|
||||||
* add `watch` command [Cory Bennett] [[ec0ac3c](https://github.com/Netflix-Skunkworks/go-jira/commit/ec0ac3c)]
|
- [664c5ca](https://github.com/go-jira/go-jira/commit/664c5cad246cbd4c861b615eb567d3874151d1a1): test on Go 1.12.x, cleanup
|
||||||
* add `rank ISSUE after|before ISSUE` command [Cory Bennett] [[8b863d2](https://github.com/Netflix-Skunkworks/go-jira/commit/8b863d2)]
|
### Docs
|
||||||
* add `vote` command [Cory Bennett] [[a08c92f](https://github.com/Netflix-Skunkworks/go-jira/commit/a08c92f)]
|
- [d8189f0](https://github.com/go-jira/go-jira/commit/d8189f0a018d1afd364237e51ca8ed43ea1aabb1): update pass documentation with password-name
|
||||||
* add `issuelinktypes` command [Cory Bennett] [[37f81a4](https://github.com/Netflix-Skunkworks/go-jira/commit/37f81a4)]
|
### Fixes #228: Make '
|
||||||
* add `issuelink` command [Cory Bennett] [[aacc9f4](https://github.com/Netflix-Skunkworks/go-jira/commit/aacc9f4)]
|
- [52a577e](https://github.com/go-jira/go-jira/commit/52a577ea48afea9efb7a1f4163301129a66f7b76): ' gpg files temporary to fix go mod
|
||||||
* fix closing duplicate issue on `dup` command [Cory Bennett] [[fc696c3](https://github.com/Netflix-Skunkworks/go-jira/commit/fc696c3)]
|
- Fixes [#228](https://github.com/go-jira/go-jira/issues/228)### Merge Branch 'Make-Password-Source-Binary-Exchangeable' Of Https
|
||||||
* rewrite checkpoint [Cory Bennett] [[36632a5](https://github.com/Netflix-Skunkworks/go-jira/commit/36632a5)]
|
- [e26fbfc](https://github.com/go-jira/go-jira/commit/e26fbfcb142f2ce8c7c33a977d4cf0b436d743eb): //github.com/patrickpichler/jira into patrickpichler-make-password-source-binary-exchangeable
|
||||||
|
### README
|
||||||
## 0.1.14 - 2017-05-10
|
- [098d963](https://github.com/go-jira/go-jira/commit/098d963881322c2b2efba48ef6a39f235bdae881): trim down the content
|
||||||
|
### T
|
||||||
* fix unsafe casting for --quiet flag [Cory Bennett] [[6f29f43](https://github.com/Netflix-Skunkworks/go-jira/commit/6f29f43)]
|
- [d237e86](https://github.com/go-jira/go-jira/commit/d237e86cda3812b23f432e90d120ec21e749a854): rename to _t to fix module support
|
||||||
* [[#80](https://github.com/Netflix-Skunkworks/go-jira/issues/80)] add `jira unassign` and `jira give ISSUE --default` commands [Cory Bennett] [[03d8633](https://github.com/Netflix-Skunkworks/go-jira/commit/03d8633)]
|
- Fixes [#228](https://github.com/go-jira/go-jira/issues/228)### Update All Usage Of User.Name To User.AccountId For Privacy Migration: Https
|
||||||
|
- [a26683e](https://github.com/go-jira/go-jira/commit/a26683e01dc7e161e735b1b387d1633bc32da2fe): //developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/
|
||||||
## 0.1.13 - 2017-04-24
|
### Pull Requests
|
||||||
|
- Merge pull request [#318](https://github.com/go-jira/go-jira/issues/318) from jrschumacher/patch-1
|
||||||
* work around `github.com/tmc/keyring` compile error for windows [Cory Bennett] [[85298e9](https://github.com/Netflix-Skunkworks/go-jira/commit/85298e9)]
|
- Merge pull request [#317](https://github.com/go-jira/go-jira/issues/317) from go-jira/privacy-migration
|
||||||
* Added generic issuelink command [David Reuss] [[cc54d11](https://github.com/Netflix-Skunkworks/go-jira/commit/cc54d11)]
|
- Merge pull request [#302](https://github.com/go-jira/go-jira/issues/302) from go-jira/simplify-template-tables
|
||||||
* Added --start parameter for pagination on results [David Reuss] [[9b94d9e](https://github.com/Netflix-Skunkworks/go-jira/commit/9b94d9e)]
|
- Merge pull request [#292](https://github.com/go-jira/go-jira/issues/292) from pdecat/cache_password
|
||||||
|
- Merge pull request [#301](https://github.com/go-jira/go-jira/issues/301) from go-jira/allow-issue-ints
|
||||||
## 0.1.12 - 2017-03-22
|
- Merge pull request [#286](https://github.com/go-jira/go-jira/issues/286) from patrickpichler/add-gopass-instructions-to-readme
|
||||||
|
- Merge pull request [#285](https://github.com/go-jira/go-jira/issues/285) from patrickpichler/add-gopass-support
|
||||||
* Implement "browse" subcommand on Windows [Claus Brod] [[ca333d8](https://github.com/Netflix-Skunkworks/go-jira/commit/ca333d8)]
|
- Merge pull request [#283](https://github.com/go-jira/go-jira/issues/283) from go-jira/sprig
|
||||||
|
- Merge pull request [#273](https://github.com/go-jira/go-jira/issues/273) from acaloiaro/master
|
||||||
## 0.1.11 - 2017-02-26
|
- Merge pull request [#282](https://github.com/go-jira/go-jira/issues/282) from pcockwell/fix/choose-direct-transition-match-if-available
|
||||||
|
- Merge pull request [#280](https://github.com/go-jira/go-jira/issues/280) from go-jira/cut_v1_0_21
|
||||||
* [[#69](https://github.com/Netflix-Skunkworks/go-jira/issues/69)] add subtask command [Cory Bennett] [[21a2ed5](https://github.com/Netflix-Skunkworks/go-jira/commit/21a2ed5)]
|
- Merge pull request [#275](https://github.com/go-jira/go-jira/issues/275) from go-jira/remove_gopkg_in
|
||||||
|
- Merge pull request [#278](https://github.com/go-jira/go-jira/issues/278) from go-jira/update-figtree
|
||||||
## 0.1.10 - 2017-02-08
|
- Merge pull request [#276](https://github.com/go-jira/go-jira/issues/276) from go-jira/fix_228
|
||||||
|
- Merge pull request [#266](https://github.com/go-jira/go-jira/issues/266) from mbethke/fix-multiline-worklog-comment
|
||||||
* set GPG_TTY in .bashrc [Cory Bennett] [[b1e552f](https://github.com/Netflix-Skunkworks/go-jira/commit/b1e552f)]
|
- Merge pull request [#263](https://github.com/go-jira/go-jira/issues/263) from kojustin/master
|
||||||
* force password in case password already exists [Cory Bennett] [[d5a2c3b](https://github.com/Netflix-Skunkworks/go-jira/commit/d5a2c3b)]
|
- Merge pull request [#253](https://github.com/go-jira/go-jira/issues/253) from mvdan/module
|
||||||
* refactor password source, allow for "pass" to be used, update tests to use `password-source: pass` [Cory Bennett] [[5a71939](https://github.com/Netflix-Skunkworks/go-jira/commit/5a71939)]
|
- Merge pull request [#240](https://github.com/go-jira/go-jira/issues/240) from jgraglia/patch-1
|
||||||
|
- Merge pull request [#219](https://github.com/go-jira/go-jira/issues/219) from kerhac/master
|
||||||
## 0.1.9 - 2016-12-18
|
- Merge pull request [#236](https://github.com/go-jira/go-jira/issues/236) from CodeLingoBot/rewrite
|
||||||
|
- Merge pull request [#245](https://github.com/go-jira/go-jira/issues/245) from justmiles/211
|
||||||
* only warn about needing login when not already running the login command [Cory Bennett] [[6c24e55](https://github.com/Netflix-Skunkworks/go-jira/commit/6c24e55)]
|
|
||||||
* fix(http): Add proxy transport [William Hearn] [[4bd740b](https://github.com/Netflix-Skunkworks/go-jira/commit/4bd740b)] [[2dff6c9](https://github.com/Netflix-Skunkworks/go-jira/commit/2dff6c9)]
|
|
||||||
|
<a name="v1.0.22"></a>
|
||||||
## 0.1.8 - 2016-11-24
|
## [v1.0.22] - 2019-09-30
|
||||||
|
### All
|
||||||
* [[#12](https://github.com/Netflix-Skunkworks/go-jira/issues/12)] integrate with keyring for password storage and provide http basic auth credentials for every request since most jira services have websudo enabled with does not allow cookie based authentication [Cory Bennett] [[b8a6e57](https://github.com/Netflix-Skunkworks/go-jira/commit/b8a6e57)]
|
- [bb9790f](https://github.com/go-jira/go-jira/commit/bb9790f28783c1b82a3685a9c4657241e906826a): unindent some code
|
||||||
* Cleaning up usage [Jay Shirley] [[8add52b](https://github.com/Netflix-Skunkworks/go-jira/commit/8add52b)]
|
- [89fe2ec](https://github.com/go-jira/go-jira/commit/89fe2ecf16709511c3e04e02f7c7906a5ac6865a): convert to a Go module
|
||||||
* Update usage [Jay Shirley] [[b56e32a](https://github.com/Netflix-Skunkworks/go-jira/commit/b56e32a)]
|
### CI
|
||||||
* use gopkg.in for links to maintain version compatibility [Cory Bennett] [[1414d1f](https://github.com/Netflix-Skunkworks/go-jira/commit/1414d1f)]
|
- [80743e4](https://github.com/go-jira/go-jira/commit/80743e4da870a1febcc65d18d08242bb201b744d): test on Go 1.12.x, cleanup
|
||||||
* golint [Cory Bennett] [[44cdebf](https://github.com/Netflix-Skunkworks/go-jira/commit/44cdebf)]
|
### Docs
|
||||||
* add "rank" command allow ordering backlog issues in agile projects [Cory Bennett] [[e4cc9c6](https://github.com/Netflix-Skunkworks/go-jira/commit/e4cc9c6)]
|
- [48c15e2](https://github.com/go-jira/go-jira/commit/48c15e2daa7b3f4c84526bd9f030828f378edfc2): update pass documentation with password-name
|
||||||
* Adding a unixproxy mechanism [Jay Shirley] [[5b9c0dd](https://github.com/Netflix-Skunkworks/go-jira/commit/5b9c0dd)]
|
### Fixes #228: Make '
|
||||||
|
- [3984d0d](https://github.com/go-jira/go-jira/commit/3984d0d4848fdfe790f46ec18bd3b71782e36c32): ' gpg files temporary to fix go mod
|
||||||
## 0.1.7 - 2016-08-24
|
- Fixes [#228](https://github.com/go-jira/go-jira/issues/228)### README
|
||||||
|
- [dc9a9de](https://github.com/go-jira/go-jira/commit/dc9a9de165859057e4596aa47961e84de34b0b4b): trim down the content
|
||||||
* Prefer transition names which match exactly [Don Brower] [[e40f9c1](https://github.com/Netflix-Skunkworks/go-jira/commit/e40f9c1)]
|
### T
|
||||||
* update tempates to make them more readable with space trimming added to go-1.6 [Cory Bennett] [[693b3e4](https://github.com/Netflix-Skunkworks/go-jira/commit/693b3e4)]
|
- [8994b42](https://github.com/go-jira/go-jira/commit/8994b42f714f8fc5b224bda8b5835f003d96ef02): rename to _t to fix module support
|
||||||
|
- Fixes [#228](https://github.com/go-jira/go-jira/issues/228)
|
||||||
## 0.1.6 - 2016-08-21
|
<a name="v1.0.21"></a>
|
||||||
|
## [v1.0.21] - 2019-09-16
|
||||||
* make "worklogs" command print output through template allow "add worklog" command to open edit template [Cory Bennett] [[cc3fbee](https://github.com/Netflix-Skunkworks/go-jira/commit/cc3fbee)]
|
### All
|
||||||
* remove extra newline at end of worklogs template [Cory Bennett] [[d08ef15](https://github.com/Netflix-Skunkworks/go-jira/commit/d08ef15)]
|
- [31c113d](https://github.com/go-jira/go-jira/commit/31c113d1baf2dba814bca3e1dcc519ab8b0269e9): unindent some code
|
||||||
* adding worklog related templates [Cory Bennett] [[ab1cd27](https://github.com/Netflix-Skunkworks/go-jira/commit/ab1cd27)]
|
- [f125ef3](https://github.com/go-jira/go-jira/commit/f125ef3fa9c7a64e8dfda9a643cadf0241b09bc7): convert to a Go module
|
||||||
|
### CI
|
||||||
## 0.1.5 - 2016-08-21
|
- [664c5ca](https://github.com/go-jira/go-jira/commit/664c5cad246cbd4c861b615eb567d3874151d1a1): test on Go 1.12.x, cleanup
|
||||||
|
### Docs
|
||||||
* update for golint [Cory Bennett] [[5a4e17c](https://github.com/Netflix-Skunkworks/go-jira/commit/5a4e17c)]
|
- [d8189f0](https://github.com/go-jira/go-jira/commit/d8189f0a018d1afd364237e51ca8ed43ea1aabb1): update pass documentation with password-name
|
||||||
* fix for go vet [Cory Bennett] [[355fb42](https://github.com/Netflix-Skunkworks/go-jira/commit/355fb42)]
|
### Fixes #228: Make '
|
||||||
|
- [52a577e](https://github.com/go-jira/go-jira/commit/52a577ea48afea9efb7a1f4163301129a66f7b76): ' gpg files temporary to fix go mod
|
||||||
|
- Fixes [#228](https://github.com/go-jira/go-jira/issues/228)### README
|
||||||
|
- [098d963](https://github.com/go-jira/go-jira/commit/098d963881322c2b2efba48ef6a39f235bdae881): trim down the content
|
||||||
|
### T
|
||||||
|
- [d237e86](https://github.com/go-jira/go-jira/commit/d237e86cda3812b23f432e90d120ec21e749a854): rename to _t to fix module support
|
||||||
|
- Fixes [#228](https://github.com/go-jira/go-jira/issues/228)### Pull Requests
|
||||||
|
- Merge pull request [#275](https://github.com/go-jira/go-jira/issues/275) from go-jira/remove_gopkg_in
|
||||||
|
- Merge pull request [#278](https://github.com/go-jira/go-jira/issues/278) from go-jira/update-figtree
|
||||||
|
- Merge pull request [#276](https://github.com/go-jira/go-jira/issues/276) from go-jira/fix_228
|
||||||
|
- Merge pull request [#266](https://github.com/go-jira/go-jira/issues/266) from mbethke/fix-multiline-worklog-comment
|
||||||
|
- Merge pull request [#263](https://github.com/go-jira/go-jira/issues/263) from kojustin/master
|
||||||
|
- Merge pull request [#253](https://github.com/go-jira/go-jira/issues/253) from mvdan/module
|
||||||
|
- Merge pull request [#240](https://github.com/go-jira/go-jira/issues/240) from jgraglia/patch-1
|
||||||
|
- Merge pull request [#219](https://github.com/go-jira/go-jira/issues/219) from kerhac/master
|
||||||
|
- Merge pull request [#236](https://github.com/go-jira/go-jira/issues/236) from CodeLingoBot/rewrite
|
||||||
|
- Merge pull request [#245](https://github.com/go-jira/go-jira/issues/245) from justmiles/211
|
||||||
|
- Merge pull request [#220](https://github.com/go-jira/go-jira/issues/220) from ejsuncy/master
|
||||||
|
|
||||||
|
|
||||||
|
<a name="v1.0.20"></a>
|
||||||
|
## [v1.0.20] - 2018-08-04
|
||||||
|
|
||||||
|
<a name="v1.0.19"></a>
|
||||||
|
## [v1.0.19] - 2018-08-02
|
||||||
|
### Pull Requests
|
||||||
|
- Merge pull request [#197](https://github.com/go-jira/go-jira/issues/197) from kojiromike/spellcheck
|
||||||
|
|
||||||
|
|
||||||
|
<a name="v1.0.18"></a>
|
||||||
|
## [v1.0.18] - 2018-07-29
|
||||||
|
### They Broke Golang.Org/X/Net: ERROR: Vendor/Golang.Org/X/Net/Proxy/Socks5.Go:11:2
|
||||||
|
- [7191c77](https://github.com/go-jira/go-jira/commit/7191c7751b2d18d7f951d089fa3235acf5748d4b): use of internal package not allowed
|
||||||
|
### Pull Requests
|
||||||
|
- Merge pull request [#178](https://github.com/go-jira/go-jira/issues/178) from vergenzt/patch-1
|
||||||
|
|
||||||
|
|
||||||
|
<a name="v1.0.17"></a>
|
||||||
|
## [v1.0.17] - 2018-04-15
|
||||||
|
### [#157] Add `Password-Directory
|
||||||
|
- [06b26c9](https://github.com/go-jira/go-jira/commit/06b26c9e00384318ec7a51fa1c5ff5de63ea686b): path` to allow overriding PASSWORD_STORE_DIR from configs
|
||||||
|
- [#157](https://github.com/go-jira/go-jira/issues/157)### Pull Requests
|
||||||
|
- Merge pull request [#161](https://github.com/go-jira/go-jira/issues/161) from vanniktech/patch-1
|
||||||
|
|
||||||
|
|
||||||
|
<a name="v1.0.16"></a>
|
||||||
|
## [v1.0.16] - 2018-04-01
|
||||||
|
### Pull Requests
|
||||||
|
- Merge pull request [#150](https://github.com/go-jira/go-jira/issues/150) from catskul/parameterized-go-makefile
|
||||||
|
- Merge pull request [#153](https://github.com/go-jira/go-jira/issues/153) from catskul/document-shell-completion
|
||||||
|
- Merge pull request [#152](https://github.com/go-jira/go-jira/issues/152) from catskul/fix-missing-priority
|
||||||
|
|
||||||
|
|
||||||
|
<a name="v1.0.15"></a>
|
||||||
|
## [v1.0.15] - 2018-03-08
|
||||||
|
### Pull Requests
|
||||||
|
- Merge pull request [#151](https://github.com/go-jira/go-jira/issues/151) from catskul/build-instructions
|
||||||
|
- Merge pull request [#142](https://github.com/go-jira/go-jira/issues/142) from anthonyrisinger/patch-1
|
||||||
|
|
||||||
|
|
||||||
|
<a name="v1.0.14"></a>
|
||||||
|
## [v1.0.14] - 2017-11-04
|
||||||
|
### Pull Requests
|
||||||
|
- Merge pull request [#130](https://github.com/go-jira/go-jira/issues/130) from onionjake/master
|
||||||
|
|
||||||
|
|
||||||
|
<a name="v1.0.13"></a>
|
||||||
|
## [v1.0.13] - 2017-10-28
|
||||||
|
### Pull Requests
|
||||||
|
- Merge pull request [#126](https://github.com/go-jira/go-jira/issues/126) from schorsch3000/master
|
||||||
|
- Merge pull request [#129](https://github.com/go-jira/go-jira/issues/129) from blachniet/logout-help-typo-fix
|
||||||
|
- Merge pull request [#124](https://github.com/go-jira/go-jira/issues/124) from gvol/master
|
||||||
|
- Merge pull request [#128](https://github.com/go-jira/go-jira/issues/128) from mivok/escape-issuetype
|
||||||
|
|
||||||
|
|
||||||
|
<a name="v1.0.12"></a>
|
||||||
|
## [v1.0.12] - 2017-10-04
|
||||||
|
|
||||||
|
<a name="v1.0.11"></a>
|
||||||
|
## [v1.0.11] - 2017-09-26
|
||||||
|
|
||||||
|
<a name="v1.0.10"></a>
|
||||||
|
## [v1.0.10] - 2017-09-18
|
||||||
|
|
||||||
|
<a name="v1.0.9"></a>
|
||||||
|
## [v1.0.9] - 2017-09-17
|
||||||
|
|
||||||
|
<a name="v1.0.8"></a>
|
||||||
|
## [v1.0.8] - 2017-09-17
|
||||||
|
|
||||||
|
<a name="v1.0.7"></a>
|
||||||
|
## [v1.0.7] - 2017-09-15
|
||||||
|
|
||||||
## 0.1.4 - 2016-08-12
|
<a name="v1.0.6"></a>
|
||||||
|
## [v1.0.6] - 2017-09-13
|
||||||
|
|
||||||
* when running "dups" on a Process Management Project type, you have to start/stop the task to resolve it [Cory Bennett] [[2c91905](https://github.com/Netflix-Skunkworks/go-jira/commit/2c91905)]
|
<a name="v1.0.5"></a>
|
||||||
* allow for defaultResolution option for transition command [Cory Bennett] [[a328c2d](https://github.com/Netflix-Skunkworks/go-jira/commit/a328c2d)]
|
## [v1.0.5] - 2017-09-11
|
||||||
* add "backlog" command for Kanban related Issues [Cory Bennett] [[5d39b23](https://github.com/Netflix-Skunkworks/go-jira/commit/5d39b23)]
|
|
||||||
* fix --noedit flag with "dups" command [Cory Bennett] [[37c07fa](https://github.com/Netflix-Skunkworks/go-jira/commit/37c07fa)]
|
|
||||||
* add "votes" and "labels" to default view template [Cory Bennett] [[6f73b8c](https://github.com/Netflix-Skunkworks/go-jira/commit/6f73b8c)]
|
|
||||||
* add "blockerType" config param, for issueLinkType use for "blocks" command [Cory Bennett] [[30fd301](https://github.com/Netflix-Skunkworks/go-jira/commit/30fd301)]
|
|
||||||
* update gitter room [Cory Bennett] [[4b822b1](https://github.com/Netflix-Skunkworks/go-jira/commit/4b822b1)]
|
|
||||||
* default issuetype to "Bug" for project that have Bug, otherwise try "Task" [Cory Bennett] [[0c807b4](https://github.com/Netflix-Skunkworks/go-jira/commit/0c807b4)]
|
|
||||||
* make view template only show fields that have values [Cory Bennett] [[8238fe8](https://github.com/Netflix-Skunkworks/go-jira/commit/8238fe8)]
|
|
||||||
* make default create template only display fields if they are valid fields for the project [Cory Bennett] [[adc2ace](https://github.com/Netflix-Skunkworks/go-jira/commit/adc2ace)]
|
|
||||||
* ignore empty json fields when processing templates [Cory Bennett] [[f5f3e28](https://github.com/Netflix-Skunkworks/go-jira/commit/f5f3e28)]
|
|
||||||
* allow JIRA_LOG_FORMAT env variable to control log output format [Cory Bennett] [[469def0](https://github.com/Netflix-Skunkworks/go-jira/commit/469def0)]
|
|
||||||
* remove extraneous debug [Cory Bennett] [[752a94d](https://github.com/Netflix-Skunkworks/go-jira/commit/752a94d)]
|
|
||||||
* add logout command modify password prompt to echo masked password [Cory Bennett] [[8ad91be](https://github.com/Netflix-Skunkworks/go-jira/commit/8ad91be)]
|
|
||||||
* tweak cookies to store hostname dump all http request/response with --verbose [Cory Bennett] [[f93fe79](https://github.com/Netflix-Skunkworks/go-jira/commit/f93fe79)]
|
|
||||||
* load configs in order of closest to cwd (/etc/go-jira.yml is last) [Cory Bennett] [[f54267b](https://github.com/Netflix-Skunkworks/go-jira/commit/f54267b)]
|
|
||||||
|
|
||||||
## 0.1.3 - 2016-07-30
|
<a name="v1.0.4"></a>
|
||||||
|
## [v1.0.4] - 2017-09-08
|
||||||
|
|
||||||
* [[#43](https://github.com/Netflix-Skunkworks/go-jira/issues/43)] add support for jira done|todo|prog commands [Cory Bennett] [[dd7d1cc](https://github.com/Netflix-Skunkworks/go-jira/commit/dd7d1cc)]
|
<a name="v1.0.3"></a>
|
||||||
* Reporter is not generally editable. [Mike Pountney] [[a637b43](https://github.com/Netflix-Skunkworks/go-jira/commit/a637b43)]
|
## [v1.0.3] - 2017-09-06
|
||||||
|
|
||||||
## 0.1.2 - 2016-06-29
|
<a name="v1.0.2"></a>
|
||||||
|
## [v1.0.2] - 2017-09-06
|
||||||
|
|
||||||
* [[#44](https://github.com/Netflix-Skunkworks/go-jira/issues/44)] Close tmpfile before rename to work around "The process cannot access the file because it is being used by another process" error on windows. [Cory Bennett] [[0980f8e](https://github.com/Netflix-Skunkworks/go-jira/commit/0980f8e)]
|
<a name="v1.0.1"></a>
|
||||||
|
## [v1.0.1] - 2017-09-06
|
||||||
|
|
||||||
## 0.1.1 - 2016-06-28
|
<a name="v1.0.0"></a>
|
||||||
|
## [v1.0.0] - 2017-09-05
|
||||||
|
|
||||||
* use USERPROFILE instead of HOME for windows, rework paths to use filepath.Join for better cross platform support [Cory Bennett] [[adcedc4](https://github.com/Netflix-Skunkworks/go-jira/commit/adcedc4)]
|
<a name="v0.1.15"></a>
|
||||||
* Include templates from a system path [Mike Pountney] [[cf10f53](https://github.com/Netflix-Skunkworks/go-jira/commit/cf10f53)]
|
## [v0.1.15] - 2017-08-25
|
||||||
* Added support for the ```expand``` option for Issues [tobyjoe] [[fb4afc9](https://github.com/Netflix-Skunkworks/go-jira/commit/fb4afc9)]
|
### Pull Requests
|
||||||
* change for api changes to go-logging [Cory Bennett] [[7bfc6e8](https://github.com/Netflix-Skunkworks/go-jira/commit/7bfc6e8)]
|
- Merge pull request [#104](https://github.com/go-jira/go-jira/issues/104) from wrouesnel/keyring-update
|
||||||
* Fix issuetype calls adding URL escaping [Jonathan Wright] [[e4a25e2](https://github.com/Netflix-Skunkworks/go-jira/commit/e4a25e2)]
|
- Merge pull request [#90](https://github.com/go-jira/go-jira/issues/90) from bbaugher/master
|
||||||
|
|
||||||
## 0.1.0 - 2016-01-29
|
|
||||||
|
|
||||||
* Fixes [#32](https://github.com/Netflix-Skunkworks/go-jira/issues/32) - make path to cookieFile if it's not present [Mike Pountney] [[6644579](https://github.com/Netflix-Skunkworks/go-jira/commit/6644579)]
|
<a name="v0.1.14"></a>
|
||||||
* Add component/components support: add and list for now. [Mike Pountney] [[d7b3226](https://github.com/Netflix-Skunkworks/go-jira/commit/d7b3226)]
|
## [v0.1.14] - 2017-05-10
|
||||||
* Tweak the CmdWatch contract and add watcher remove support [Mike Pountney] [[383847a](https://github.com/Netflix-Skunkworks/go-jira/commit/383847a)]
|
|
||||||
* Amend vote/unvote to be vote/vote --down [Mike Pountney] [[797edef](https://github.com/Netflix-Skunkworks/go-jira/commit/797edef)]
|
|
||||||
* Add 'vote' and 'unvote' [Mike Pountney] [[c95e66e](https://github.com/Netflix-Skunkworks/go-jira/commit/c95e66e)]
|
|
||||||
|
|
||||||
## 0.0.20 - 2016-01-21
|
<a name="v0.1.13"></a>
|
||||||
|
## [v0.1.13] - 2017-04-24
|
||||||
|
### Pull Requests
|
||||||
|
- Merge pull request [#78](https://github.com/go-jira/go-jira/issues/78) from davidreuss/generic-issuelink
|
||||||
|
- Merge pull request [#77](https://github.com/go-jira/go-jira/issues/77) from davidreuss/fix-start-parameter-for-pagination
|
||||||
|
|
||||||
* [issue [#28](https://github.com/Netflix-Skunkworks/go-jira/issues/28)] check to make sure we got back issuetypes for create metadata [Cory Bennett] [[ee0e780](https://github.com/Netflix-Skunkworks/go-jira/commit/ee0e780)]
|
|
||||||
* Add insecure option for TLS endpoints [Brian Lalor] [[6a88bb9](https://github.com/Netflix-Skunkworks/go-jira/commit/6a88bb9)]
|
|
||||||
* Correct naming of parameter: set/add/remove are actions. [Mike Pountney] [[303784f](https://github.com/Netflix-Skunkworks/go-jira/commit/303784f)]
|
|
||||||
* Tweak CmdLabels args so that magic happens with CLI [Mike Pountney] [[40a7c65](https://github.com/Netflix-Skunkworks/go-jira/commit/40a7c65)]
|
|
||||||
* Expose ViewTicket as per FindIssues [Mike Pountney] [[8977f3d](https://github.com/Netflix-Skunkworks/go-jira/commit/8977f3d)]
|
|
||||||
* Add exposed versions of getTemplate and runTemplate [Mike Pountney] [[da6cbd5](https://github.com/Netflix-Skunkworks/go-jira/commit/da6cbd5)]
|
|
||||||
* Add 'labels' command to set/add/remove labels [Mike Pountney] [[230b52d](https://github.com/Netflix-Skunkworks/go-jira/commit/230b52d)]
|
|
||||||
* Add a 'join' func to the template engine [Mike Pountney] [[a7820fe](https://github.com/Netflix-Skunkworks/go-jira/commit/a7820fe)]
|
|
||||||
* make "jira" golang package, move code from jira/cli to root, move jira/main.go to main/main.go [Cory Bennett] [[7268b9e](https://github.com/Netflix-Skunkworks/go-jira/commit/7268b9e)]
|
|
||||||
|
|
||||||
## 0.0.19 - 2015-12-09
|
<a name="v0.1.12"></a>
|
||||||
|
## [v0.1.12] - 2017-03-22
|
||||||
|
### Pull Requests
|
||||||
|
- Merge pull request [#74](https://github.com/go-jira/go-jira/issues/74) from clausb/BrowseOnWindows
|
||||||
|
|
||||||
* fix jira trans TRANS ISSUE (case sensitivity issue), also go fmt [Cory Bennett] [[3c30f3b](https://github.com/Netflix-Skunkworks/go-jira/commit/3c30f3b)]
|
|
||||||
|
|
||||||
## 0.0.18 - 2015-12-03
|
<a name="v0.1.11"></a>
|
||||||
|
## [v0.1.11] - 2017-02-26
|
||||||
|
|
||||||
* need to default "quiet" to false [Cory Bennett] [[4f4a89b](https://github.com/Netflix-Skunkworks/go-jira/commit/4f4a89b)]
|
<a name="v0.1.10"></a>
|
||||||
|
## [v0.1.10] - 2017-02-08
|
||||||
|
### Doc Tweak
|
||||||
|
- [e6faa4e](https://github.com/go-jira/go-jira/commit/e6faa4eab1a8d6a7fb624b79bb58a641d02e876b): add info for setting username
|
||||||
|
### Merge Branch 'Master' Of Github.Com
|
||||||
|
- [63bc2ae](https://github.com/go-jira/go-jira/commit/63bc2ae15a2ebafa16861965951800e0d5c122bd): Netflix-Skunkworks/go-jira
|
||||||
|
### Refactor Password Source, Allow For "Pass" To Be Used, Update Tests To Use `Password-Source
|
||||||
|
- [cb70941](https://github.com/go-jira/go-jira/commit/cb70941aad2b8198f5c8ad8d1e1a7a98dc820cd9): pass`
|
||||||
|
### Pull Requests
|
||||||
|
- Merge pull request [#65](https://github.com/go-jira/go-jira/issues/65) from mlbright/patch-1
|
||||||
|
- Merge pull request [#64](https://github.com/go-jira/go-jira/issues/64) from astrostl/patch-2
|
||||||
|
- Merge pull request [#62](https://github.com/go-jira/go-jira/issues/62) from astrostl/patch-1
|
||||||
|
|
||||||
## 0.0.17 - 2015-12-03
|
|
||||||
|
|
||||||
* add --quiet command to not print the OK .. add --saveFile option to print the issue/link to a file on create command [Cory Bennett] [[c9ac162](https://github.com/Netflix-Skunkworks/go-jira/commit/c9ac162)]
|
<a name="v0.1.9"></a>
|
||||||
* fix overrides [Cory Bennett] [[eaddfe6](https://github.com/Netflix-Skunkworks/go-jira/commit/eaddfe6)]
|
## [v0.1.9] - 2016-12-18
|
||||||
* add abstract request wrapper to allow you to access/process random apis supported by Jira but not yet supported by go-jira [Cory Bennett] [[90ef56a](https://github.com/Netflix-Skunkworks/go-jira/commit/90ef56a)]
|
### Fix(Http)
|
||||||
|
- [b326623](https://github.com/go-jira/go-jira/commit/b326623ed22677a3ff76d2c4c67bb7ca7ecb3877): Add proxy transport
|
||||||
|
- [72c78c6](https://github.com/go-jira/go-jira/commit/72c78c6c1c63a70d837c8e367754792c8a30ae06): Add proxy transport
|
||||||
|
### Merge Branch 'Master' Of Github.Com
|
||||||
|
- [ac515e2](https://github.com/go-jira/go-jira/commit/ac515e2743e1bcf5f492a0e25d2b084f3311f0d0): Netflix-Skunkworks/go-jira
|
||||||
|
### Pull Requests
|
||||||
|
- Merge pull request [#61](https://github.com/go-jira/go-jira/issues/61) from sylus/feature-proxy
|
||||||
|
- Merge pull request [#60](https://github.com/go-jira/go-jira/issues/60) from facundoolano/patch-1
|
||||||
|
|
||||||
## 0.0.16 - 2015-11-23
|
|
||||||
|
|
||||||
* jira edit should not require one arguemnt (allow for --query) [Cory Bennett] [[a1eb4a1](https://github.com/Netflix-Skunkworks/go-jira/commit/a1eb4a1)]
|
<a name="v0.1.8"></a>
|
||||||
|
## [v0.1.8] - 2016-11-24
|
||||||
|
### Pull Requests
|
||||||
|
- Merge pull request [#53](https://github.com/go-jira/go-jira/issues/53) from jshirley/master
|
||||||
|
|
||||||
## 0.0.15 - 2015-11-23
|
|
||||||
|
|
||||||
* [[#17](https://github.com/Netflix-Skunkworks/go-jira/issues/17)] print usage on missing arguments [Cory Bennett] [[fd2a2fe](https://github.com/Netflix-Skunkworks/go-jira/commit/fd2a2fe)]
|
<a name="v0.1.7"></a>
|
||||||
|
## [v0.1.7] - 2016-08-24
|
||||||
|
### Pull Requests
|
||||||
|
- Merge pull request [#52](https://github.com/go-jira/go-jira/issues/52) from dbrower/master
|
||||||
|
|
||||||
## 0.0.14 - 2015-11-17
|
|
||||||
|
|
||||||
* s/enpoint/endpoint/g [Oliver Schrenk] [[c5d251d](https://github.com/Netflix-Skunkworks/go-jira/commit/c5d251d)]
|
<a name="v0.1.6"></a>
|
||||||
* Implement dateFormat template command [Mike Pountney] [[68d3bae](https://github.com/Netflix-Skunkworks/go-jira/commit/68d3bae)]
|
## [v0.1.6] - 2016-08-21
|
||||||
* Add 'updated' field to default queryfields. [Mike Pountney] [[91e2475](https://github.com/Netflix-Skunkworks/go-jira/commit/91e2475)]
|
|
||||||
* Fix export-templates option (typo) [Mike Pountney] [[4d7fdb8](https://github.com/Netflix-Skunkworks/go-jira/commit/4d7fdb8)]
|
|
||||||
* when yaml element resolves to "\n" strip it out so we dont post it to jira [Cory Bennett] [[47ced2f](https://github.com/Netflix-Skunkworks/go-jira/commit/47ced2f)]
|
|
||||||
* print PUT/POST data when using --dryrun to help debug [Cory Bennett] [[618f245](https://github.com/Netflix-Skunkworks/go-jira/commit/618f245)]
|
|
||||||
|
|
||||||
## 0.0.13 - 2015-09-19
|
<a name="v0.1.5"></a>
|
||||||
|
## [v0.1.5] - 2016-08-21
|
||||||
|
|
||||||
* replace dead/deprecated code.google.com/p/gopass with golang.org/x/crypto/ssh/terminal for reading password from stdin [Cory Bennett] [[909eb06](https://github.com/Netflix-Skunkworks/go-jira/commit/909eb06)]
|
<a name="v0.1.4"></a>
|
||||||
|
## [v0.1.4] - 2016-08-12
|
||||||
|
|
||||||
## 0.0.12 - 2015-09-18
|
<a name="v0.1.3"></a>
|
||||||
|
## [v0.1.3] - 2016-07-30
|
||||||
|
### Pull Requests
|
||||||
|
- Merge pull request [#24](https://github.com/go-jira/go-jira/issues/24) from mikepea/edit_template_common
|
||||||
|
|
||||||
* fix exception from "jira create" [Cory Bennett] [[9348a4b](https://github.com/Netflix-Skunkworks/go-jira/commit/9348a4b)]
|
|
||||||
* add some debug messages to help diagnose login failures [Cory Bennett] [[1c08a7d](https://github.com/Netflix-Skunkworks/go-jira/commit/1c08a7d)]
|
|
||||||
|
|
||||||
## 0.0.11 - 2015-09-16
|
<a name="v0.1.2"></a>
|
||||||
|
## [v0.1.2] - 2016-06-29
|
||||||
|
|
||||||
* add --version [Cory Bennett] [[8385ee2](https://github.com/Netflix-Skunkworks/go-jira/commit/8385ee2)]
|
<a name="v0.1.1"></a>
|
||||||
* fix command line parser broken in 0.0.10 [Cory Bennett] [[15ae929](https://github.com/Netflix-Skunkworks/go-jira/commit/15ae929)]
|
## [v0.1.1] - 2016-06-28
|
||||||
|
### Merge Branch 'Master' Of Github.Com
|
||||||
|
- [dd0f5ef](https://github.com/go-jira/go-jira/commit/dd0f5efd3247157686c2c88817d3ad375de399ea): Netflix-Skunkworks/go-jira
|
||||||
|
### Pull Requests
|
||||||
|
- Merge pull request [#39](https://github.com/go-jira/go-jira/issues/39) from mikepea/system_template_dir
|
||||||
|
- Merge pull request [#38](https://github.com/go-jira/go-jira/issues/38) from jglick/patch-1
|
||||||
|
- Merge pull request [#37](https://github.com/go-jira/go-jira/issues/37) from tobyjoe/add-resource-expansion
|
||||||
|
- Merge pull request [#35](https://github.com/go-jira/go-jira/issues/35) from QuinnyPig/fix-readme
|
||||||
|
- Merge pull request [#34](https://github.com/go-jira/go-jira/issues/34) from jonathanio/fix/issuetypes-url-escaping
|
||||||
|
|
||||||
## 0.0.10 - 2015-09-15
|
|
||||||
|
|
||||||
* allow for command aliasing in conjunction with executable config files. Issue #5 [Cory Bennett] [[23590d4](https://github.com/Netflix-Skunkworks/go-jira/commit/23590d4)]
|
<a name="v0.1.0"></a>
|
||||||
* update usage [Cory Bennett] [[ef7a57e](https://github.com/Netflix-Skunkworks/go-jira/commit/ef7a57e)]
|
## [v0.1.0] - 2016-01-29
|
||||||
|
### Add Component/Components Support
|
||||||
|
- [595a521](https://github.com/go-jira/go-jira/commit/595a5212b43be28e01a0d5a6cf98a8de89383e41): add and list for now.
|
||||||
|
### Merge Branch 'Master' Of Github.Com
|
||||||
|
- [9e90376](https://github.com/go-jira/go-jira/commit/9e90376816c295d3a75b4f51703c24fd95873625): Netflix-Skunkworks/go-jira
|
||||||
|
- [382bf4f](https://github.com/go-jira/go-jira/commit/382bf4faeb17198b54950a05b0fdb3e126af8d73): Netflix-Skunkworks/go-jira
|
||||||
|
### Pull Requests
|
||||||
|
- Merge pull request [#33](https://github.com/go-jira/go-jira/issues/33) from mikepea/make_jirad
|
||||||
|
- Merge pull request [#31](https://github.com/go-jira/go-jira/issues/31) from mikepea/component_mgmt
|
||||||
|
- Merge pull request [#30](https://github.com/go-jira/go-jira/issues/30) from mikepea/unwatch_support
|
||||||
|
- Merge pull request [#26](https://github.com/go-jira/go-jira/issues/26) from mikepea/vote_support
|
||||||
|
|
||||||
## 0.0.9 - 2015-09-15
|
|
||||||
|
|
||||||
* use forked yaml.v2 so as to not lose line terminations present in jira fields [Cory Bennett] [[f84e77f](https://github.com/Netflix-Skunkworks/go-jira/commit/f84e77f)]
|
<a name="v0.0.20"></a>
|
||||||
* adding a |~ literal yaml syntax to just chomp a single newline (again to preserve existing formatting in jira fields) [Cory Bennett] [[f84e77f](https://github.com/Netflix-Skunkworks/go-jira/commit/f84e77f)]
|
## [v0.0.20] - 2016-01-21
|
||||||
* for indent/comment allow for unicode line termination characters that yaml will use for parsing [Cory Bennett] [[f84e77f](https://github.com/Netflix-Skunkworks/go-jira/commit/f84e77f)]
|
### Correct Naming Of Parameter
|
||||||
* fix "edit" default option, change how defaults are dealt with for filters [Cory Bennett] [[4265913](https://github.com/Netflix-Skunkworks/go-jira/commit/4265913)]
|
- [8e66246](https://github.com/go-jira/go-jira/commit/8e662462dac6cccdf8af277797777caeff3ad2bc): set/add/remove are actions.
|
||||||
* for edit template add issue id as comment, also add "comments" as comment so you can review the comment details while editing [Cory Bennett] [[968a9df](https://github.com/Netflix-Skunkworks/go-jira/commit/968a9df)]
|
### Pull Requests
|
||||||
* add "comment" template filter to comment out multiline statements [Cory Bennett] [[d664868](https://github.com/Netflix-Skunkworks/go-jira/commit/d664868)]
|
- Merge pull request [#27](https://github.com/go-jira/go-jira/issues/27) from blalor/insecure-skip-verify
|
||||||
* add getOpt wrappers to get options with defaults [Cory Bennett] [[c0070cf](https://github.com/Netflix-Skunkworks/go-jira/commit/c0070cf)]
|
- Merge pull request [#21](https://github.com/go-jira/go-jira/issues/21) from mikepea/label_command
|
||||||
* make --dryrun work [Cory Bennett] [[d229ac1](https://github.com/Netflix-Skunkworks/go-jira/commit/d229ac1)]
|
- Merge pull request [#22](https://github.com/go-jira/go-jira/issues/22) from mikepea/library_break_out
|
||||||
* refactor config/option loading so command options override settings in config files [Cory Bennett] [[d229ac1](https://github.com/Netflix-Skunkworks/go-jira/commit/d229ac1)]
|
- Merge pull request [#20](https://github.com/go-jira/go-jira/issues/20) from mikepea/add_join_template_func
|
||||||
* allow query options to be used on the "edit" command to iterate editing [Cory Bennett] [[d229ac1](https://github.com/Netflix-Skunkworks/go-jira/commit/d229ac1)]
|
|
||||||
* remove duplication for defaults [Cory Bennett] [[f8c8ddf](https://github.com/Netflix-Skunkworks/go-jira/commit/f8c8ddf)]
|
|
||||||
* use optigo for option parsing, drop docopt [Cory Bennett] [[7bbd571](https://github.com/Netflix-Skunkworks/go-jira/commit/7bbd571)]
|
|
||||||
* allow "abort: true" to be set while editing to cancel the edit operation [Cory Bennett] [[ea67a77](https://github.com/Netflix-Skunkworks/go-jira/commit/ea67a77)]
|
|
||||||
* if no changes are made on edit templates then abort edit [Cory Bennett] [[e69b65c](https://github.com/Netflix-Skunkworks/go-jira/commit/e69b65c)]
|
|
||||||
|
|
||||||
## 0.0.8 - 2015-07-31
|
|
||||||
|
|
||||||
* Add --max_results option for 'ls' [Mike Pountney] [[e06ff0c](https://github.com/Netflix-Skunkworks/go-jira/commit/e06ff0c)]
|
<a name="0.0.19"></a>
|
||||||
|
## [0.0.19] - 2015-12-09
|
||||||
|
|
||||||
## 0.0.7 - 2015-07-01
|
<a name="0.0.18"></a>
|
||||||
|
## [0.0.18] - 2015-12-03
|
||||||
|
|
||||||
* fix "take" command not honouring user option [Andrew Haigh] [[8f1d2b9](https://github.com/Netflix-Skunkworks/go-jira/commit/8f1d2b9)]
|
<a name="0.0.17"></a>
|
||||||
* fix typo [Cory Bennett] [[06f57fe](https://github.com/Netflix-Skunkworks/go-jira/commit/06f57fe)]
|
## [0.0.17] - 2015-12-03
|
||||||
|
|
||||||
## 0.0.6 - 2015-02-27
|
<a name="0.0.16"></a>
|
||||||
|
## [0.0.16] - 2015-11-23
|
||||||
|
|
||||||
* allow --sort= to disable sort override [Cory Bennett] [[701f091](https://github.com/Netflix-Skunkworks/go-jira/commit/701f091)]
|
<a name="0.0.15"></a>
|
||||||
* fix default JIRA_OPERATION env variable [Cory Bennett] [[82fd9b9](https://github.com/Netflix-Skunkworks/go-jira/commit/82fd9b9)]
|
## [0.0.15] - 2015-11-23
|
||||||
* automatically close duplicate issues with "Duplicate" resolution [Cory Bennett] [[ebf1700](https://github.com/Netflix-Skunkworks/go-jira/commit/ebf1700)]
|
|
||||||
* set JIRA_OPERATION to "view" when no operation used (ie: jira GOJIRA-123) [Cory Bennett] [[050848a](https://github.com/Netflix-Skunkworks/go-jira/commit/050848a)]
|
|
||||||
* add --sort option to "list" command [Cory Bennett] [[f359030](https://github.com/Netflix-Skunkworks/go-jira/commit/f359030)]
|
|
||||||
|
|
||||||
## 0.0.5 - 2015-02-21
|
<a name="0.0.14"></a>
|
||||||
|
## [0.0.14] - 2015-11-17
|
||||||
|
### Pull Requests
|
||||||
|
- Merge pull request [#16](https://github.com/go-jira/go-jira/issues/16) from oschrenk/fix-typo
|
||||||
|
- Merge pull request [#14](https://github.com/go-jira/go-jira/issues/14) from mikepea/ls_with_updated
|
||||||
|
|
||||||
* handle editor having arguments [Cory Bennett] [[7186fb3](https://github.com/Netflix-Skunkworks/go-jira/commit/7186fb3)]
|
|
||||||
* add more template error handling [Cory Bennett] [[3e6f2b3](https://github.com/Netflix-Skunkworks/go-jira/commit/3e6f2b3)]
|
|
||||||
* allow create template to specify defalt watchers with -o watchers=... [Cory Bennett] [[4db2e4e](https://github.com/Netflix-Skunkworks/go-jira/commit/4db2e4e)]
|
|
||||||
* if config files are executable then run them and parse the output [Cory Bennett] [[7a2f7f5](https://github.com/Netflix-Skunkworks/go-jira/commit/7a2f7f5)]
|
|
||||||
|
|
||||||
## 0.0.4 - 2015-02-19
|
<a name="0.0.13"></a>
|
||||||
|
## [0.0.13] - 2015-09-19
|
||||||
|
|
||||||
* add --template option to export-templates to export a single template [Cory Bennett] [[343fbb6](https://github.com/Netflix-Skunkworks/go-jira/commit/343fbb6)]
|
<a name="0.0.12"></a>
|
||||||
* add "table" template to be used with "list" command [Cory Bennett] [[8954ec1](https://github.com/Netflix-Skunkworks/go-jira/commit/8954ec1)]
|
## [0.0.12] - 2015-09-18
|
||||||
|
|
||||||
## 0.0.3 - 2015-02-19
|
<a name="0.0.11"></a>
|
||||||
|
## [0.0.11] - 2015-09-16
|
||||||
|
|
||||||
* [issue [#8](https://github.com/Netflix-Skunkworks/go-jira/issues/8)] detect X-Seraph-Loginreason: AUTHENTICATION_DENIED header to catch login failures [Cory Bennett] [[2dcf665](https://github.com/Netflix-Skunkworks/go-jira/commit/2dcf665)]
|
<a name="0.0.10"></a>
|
||||||
* project should always be uppercase [Jay Buffington] [[1b69d12](https://github.com/Netflix-Skunkworks/go-jira/commit/1b69d12)]
|
## [0.0.10] - 2015-09-15
|
||||||
* if response is 400, check json for errorMessages and log them [Jay Buffington] [[4924dfa](https://github.com/Netflix-Skunkworks/go-jira/commit/4924dfa)]
|
|
||||||
* validate project [Jay Buffington] [[dc5ae42](https://github.com/Netflix-Skunkworks/go-jira/commit/dc5ae42)]
|
|
||||||
|
|
||||||
## 0.0.2 - 2015-02-18
|
<a name="0.0.9"></a>
|
||||||
|
## [0.0.9] - 2015-09-15
|
||||||
|
### Allow "Abort
|
||||||
|
- [80b6f5a](https://github.com/go-jira/go-jira/commit/80b6f5a198fbe17aa0245c470d47c2988d8624c3): true" to be set while editing to cancel the edit operation
|
||||||
|
|
||||||
* add missing --override options on transition command
|
<a name="0.0.8"></a>
|
||||||
* add browse command
|
## [0.0.8] - 2015-07-31
|
||||||
|
### Pull Requests
|
||||||
|
- Merge pull request [#11](https://github.com/go-jira/go-jira/issues/11) from mikepea/max_results_option
|
||||||
|
|
||||||
|
### Note
|
||||||
|
|
||||||
|
that testing against our JIRA instance, in a project with
|
||||||
|
more than 1000 open issues, suggests that the JIRA has an internal
|
||||||
|
limit of 1000 results in a single query.
|
||||||
|
|
||||||
|
|
||||||
|
<a name="0.0.7"></a>
|
||||||
|
## [0.0.7] - 2015-07-01
|
||||||
|
### Merge Branch 'Master' Of Github.Com
|
||||||
|
- [b72040b](https://github.com/go-jira/go-jira/commit/b72040bfd413bcdc88ca2c3f6843a7f6dee2e898): Netflix-Skunkworks/go-jira
|
||||||
|
### Pull Requests
|
||||||
|
- Merge pull request [#9](https://github.com/go-jira/go-jira/issues/9) from nelfin/quickfix/take-user
|
||||||
|
|
||||||
|
|
||||||
|
<a name="0.0.6"></a>
|
||||||
|
## [0.0.6] - 2015-02-27
|
||||||
|
### Set JIRA_OPERATION To "View" When No Operation Used (Ie
|
||||||
|
- [8040746](https://github.com/go-jira/go-jira/commit/8040746bcf6aac6e3ff6e419c349661a8fc9bf99): jira GOJIRA-123)
|
||||||
|
|
||||||
|
<a name="0.0.5"></a>
|
||||||
|
## [0.0.5] - 2015-02-21
|
||||||
|
|
||||||
|
<a name="0.0.4"></a>
|
||||||
|
## [0.0.4] - 2015-02-19
|
||||||
|
|
||||||
|
<a name="0.0.3"></a>
|
||||||
|
## [0.0.3] - 2015-02-19
|
||||||
|
### [Issue #8] Detect X-Seraph-Loginreason
|
||||||
|
- [f3feff7](https://github.com/go-jira/go-jira/commit/f3feff796fbecca6477ecbc1e9dae6a2b78e755c): AUTHENTICATION_DENIED header to catch login failures
|
||||||
|
- [#8](https://github.com/go-jira/go-jira/issues/8)### Pull Requests
|
||||||
|
- Merge pull request [#7](https://github.com/go-jira/go-jira/issues/7) from jaybuff/empty-projects
|
||||||
|
|
||||||
|
|
||||||
|
<a name="0.0.2"></a>
|
||||||
|
## [0.0.2] - 2015-02-18
|
||||||
|
|
||||||
|
<a name="0.0.1"></a>
|
||||||
## 0.0.1 - 2015-02-18
|
## 0.0.1 - 2015-02-18
|
||||||
|
### Adding Commands
|
||||||
|
- [18f10fd](https://github.com/go-jira/go-jira/commit/18f10fd12521584c7d85b20dff2b1c2da0854cb9): * create * dups * blocks * watch
|
||||||
|
### Merge Branch 'Nil-Assignee' Of Https
|
||||||
|
- [25539ef](https://github.com/go-jira/go-jira/commit/25539efedda0e06e103fc942e16405c0c09ba621): //github.com/jaybuff/go-jira into jaybuff-nil-assignee
|
||||||
|
### Work In Progress, Minor Refactor. Added Commands
|
||||||
|
- [acbc24b](https://github.com/go-jira/go-jira/commit/acbc24b2096f31a5805fa48984724a4a6c1da431): * login * editmeta ISSUE * edit ISSUE * issuetypes [-p PROJECT] * createmeta [-p PROJECT] [-i ISSUETYPE] * transitions ISSUE
|
||||||
|
### Pull Requests
|
||||||
|
- Merge pull request [#2](https://github.com/go-jira/go-jira/issues/2) from jaybuff/clean-up
|
||||||
|
|
||||||
* Initial experimental release
|
|
||||||
|
[Unreleased]: https://github.com/go-jira/go-jira/compare/v1.0.28...HEAD
|
||||||
|
[v1.0.28]: https://github.com/go-jira/go-jira/compare/v1.0.27...v1.0.28
|
||||||
|
[v1.0.27]: https://github.com/go-jira/go-jira/compare/v1.0.26...v1.0.27
|
||||||
|
[v1.0.26]: https://github.com/go-jira/go-jira/compare/v1.0.25...v1.0.26
|
||||||
|
[v1.0.25]: https://github.com/go-jira/go-jira/compare/v1.0.24...v1.0.25
|
||||||
|
[v1.0.24]: https://github.com/go-jira/go-jira/compare/v1.0.23...v1.0.24
|
||||||
|
[v1.0.23]: https://github.com/go-jira/go-jira/compare/v1.0.22...v1.0.23
|
||||||
|
[v1.0.22]: https://github.com/go-jira/go-jira/compare/v1.0.21...v1.0.22
|
||||||
|
[v1.0.21]: https://github.com/go-jira/go-jira/compare/v1.0.20...v1.0.21
|
||||||
|
[v1.0.20]: https://github.com/go-jira/go-jira/compare/v1.0.19...v1.0.20
|
||||||
|
[v1.0.19]: https://github.com/go-jira/go-jira/compare/v1.0.18...v1.0.19
|
||||||
|
[v1.0.18]: https://github.com/go-jira/go-jira/compare/v1.0.17...v1.0.18
|
||||||
|
[v1.0.17]: https://github.com/go-jira/go-jira/compare/v1.0.16...v1.0.17
|
||||||
|
[v1.0.16]: https://github.com/go-jira/go-jira/compare/v1.0.15...v1.0.16
|
||||||
|
[v1.0.15]: https://github.com/go-jira/go-jira/compare/v1.0.14...v1.0.15
|
||||||
|
[v1.0.14]: https://github.com/go-jira/go-jira/compare/v1.0.13...v1.0.14
|
||||||
|
[v1.0.13]: https://github.com/go-jira/go-jira/compare/v1.0.12...v1.0.13
|
||||||
|
[v1.0.12]: https://github.com/go-jira/go-jira/compare/v1.0.11...v1.0.12
|
||||||
|
[v1.0.11]: https://github.com/go-jira/go-jira/compare/v1.0.10...v1.0.11
|
||||||
|
[v1.0.10]: https://github.com/go-jira/go-jira/compare/v1.0.9...v1.0.10
|
||||||
|
[v1.0.9]: https://github.com/go-jira/go-jira/compare/v1.0.8...v1.0.9
|
||||||
|
[v1.0.8]: https://github.com/go-jira/go-jira/compare/v1.0.7...v1.0.8
|
||||||
|
[v1.0.7]: https://github.com/go-jira/go-jira/compare/v1.0.6...v1.0.7
|
||||||
|
[v1.0.6]: https://github.com/go-jira/go-jira/compare/v1.0.5...v1.0.6
|
||||||
|
[v1.0.5]: https://github.com/go-jira/go-jira/compare/v1.0.4...v1.0.5
|
||||||
|
[v1.0.4]: https://github.com/go-jira/go-jira/compare/v1.0.3...v1.0.4
|
||||||
|
[v1.0.3]: https://github.com/go-jira/go-jira/compare/v1.0.2...v1.0.3
|
||||||
|
[v1.0.2]: https://github.com/go-jira/go-jira/compare/v1.0.1...v1.0.2
|
||||||
|
[v1.0.1]: https://github.com/go-jira/go-jira/compare/v1.0.0...v1.0.1
|
||||||
|
[v1.0.0]: https://github.com/go-jira/go-jira/compare/v0.1.15...v1.0.0
|
||||||
|
[v0.1.15]: https://github.com/go-jira/go-jira/compare/v0.1.14...v0.1.15
|
||||||
|
[v0.1.14]: https://github.com/go-jira/go-jira/compare/v0.1.13...v0.1.14
|
||||||
|
[v0.1.13]: https://github.com/go-jira/go-jira/compare/v0.1.12...v0.1.13
|
||||||
|
[v0.1.12]: https://github.com/go-jira/go-jira/compare/v0.1.11...v0.1.12
|
||||||
|
[v0.1.11]: https://github.com/go-jira/go-jira/compare/v0.1.10...v0.1.11
|
||||||
|
[v0.1.10]: https://github.com/go-jira/go-jira/compare/v0.1.9...v0.1.10
|
||||||
|
[v0.1.9]: https://github.com/go-jira/go-jira/compare/v0.1.8...v0.1.9
|
||||||
|
[v0.1.8]: https://github.com/go-jira/go-jira/compare/v0.1.7...v0.1.8
|
||||||
|
[v0.1.7]: https://github.com/go-jira/go-jira/compare/v0.1.6...v0.1.7
|
||||||
|
[v0.1.6]: https://github.com/go-jira/go-jira/compare/v0.1.5...v0.1.6
|
||||||
|
[v0.1.5]: https://github.com/go-jira/go-jira/compare/v0.1.4...v0.1.5
|
||||||
|
[v0.1.4]: https://github.com/go-jira/go-jira/compare/v0.1.3...v0.1.4
|
||||||
|
[v0.1.3]: https://github.com/go-jira/go-jira/compare/v0.1.2...v0.1.3
|
||||||
|
[v0.1.2]: https://github.com/go-jira/go-jira/compare/v0.1.1...v0.1.2
|
||||||
|
[v0.1.1]: https://github.com/go-jira/go-jira/compare/v0.1.0...v0.1.1
|
||||||
|
[v0.1.0]: https://github.com/go-jira/go-jira/compare/v0.0.20...v0.1.0
|
||||||
|
[v0.0.20]: https://github.com/go-jira/go-jira/compare/0.0.19...v0.0.20
|
||||||
|
[0.0.19]: https://github.com/go-jira/go-jira/compare/0.0.18...0.0.19
|
||||||
|
[0.0.18]: https://github.com/go-jira/go-jira/compare/0.0.17...0.0.18
|
||||||
|
[0.0.17]: https://github.com/go-jira/go-jira/compare/0.0.16...0.0.17
|
||||||
|
[0.0.16]: https://github.com/go-jira/go-jira/compare/0.0.15...0.0.16
|
||||||
|
[0.0.15]: https://github.com/go-jira/go-jira/compare/0.0.14...0.0.15
|
||||||
|
[0.0.14]: https://github.com/go-jira/go-jira/compare/0.0.13...0.0.14
|
||||||
|
[0.0.13]: https://github.com/go-jira/go-jira/compare/0.0.12...0.0.13
|
||||||
|
[0.0.12]: https://github.com/go-jira/go-jira/compare/0.0.11...0.0.12
|
||||||
|
[0.0.11]: https://github.com/go-jira/go-jira/compare/0.0.10...0.0.11
|
||||||
|
[0.0.10]: https://github.com/go-jira/go-jira/compare/0.0.9...0.0.10
|
||||||
|
[0.0.9]: https://github.com/go-jira/go-jira/compare/0.0.8...0.0.9
|
||||||
|
[0.0.8]: https://github.com/go-jira/go-jira/compare/0.0.7...0.0.8
|
||||||
|
[0.0.7]: https://github.com/go-jira/go-jira/compare/0.0.6...0.0.7
|
||||||
|
[0.0.6]: https://github.com/go-jira/go-jira/compare/0.0.5...0.0.6
|
||||||
|
[0.0.5]: https://github.com/go-jira/go-jira/compare/0.0.4...0.0.5
|
||||||
|
[0.0.4]: https://github.com/go-jira/go-jira/compare/0.0.3...0.0.4
|
||||||
|
[0.0.3]: https://github.com/go-jira/go-jira/compare/0.0.2...0.0.3
|
||||||
|
[0.0.2]: https://github.com/go-jira/go-jira/compare/0.0.1...0.0.2
|
||||||
|
|||||||
@@ -0,0 +1,492 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## 1.0.25 - 2020-09-11
|
||||||
|
|
||||||
|
* Ensure body is NPE safe [Louis DeLosSantos] [[42e5d23](https://github.com/Netflix-Skunkworks/go-jira/commit/42e5d23)]
|
||||||
|
* Support empty responses in request commands [Louis DeLosSantos] [[b572037](https://github.com/Netflix-Skunkworks/go-jira/commit/b572037)]
|
||||||
|
|
||||||
|
## 1.0.24 - 2020-09-04
|
||||||
|
|
||||||
|
* Make -h flag show --help [Benjamin Kane] [[4bf1d03](https://github.com/Netflix-Skunkworks/go-jira/commit/4bf1d03)]
|
||||||
|
* transition: map field name to id [Louis DeLosSantos] [[3c1c4d9](https://github.com/Netflix-Skunkworks/go-jira/commit/3c1c4d9)]
|
||||||
|
* username-deprecation: use email and display names [Louis DeLosSantos] [[6a27e28](https://github.com/Netflix-Skunkworks/go-jira/commit/6a27e28)]
|
||||||
|
* Add support to get all comments for an issue [Thibault Jamet] [[a311d0d](https://github.com/Netflix-Skunkworks/go-jira/commit/a311d0d)]
|
||||||
|
* update all usage of user.name to user.accountId for privacy migration: https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/ [Cory Bennett] [[a26683e](https://github.com/Netflix-Skunkworks/go-jira/commit/a26683e)]
|
||||||
|
* add template functions to handle table output, fixes [#176](https://github.com/Netflix-Skunkworks/go-jira/issues/176), replaces [#296](https://github.com/Netflix-Skunkworks/go-jira/issues/296) [Cory Bennett] [[7e97463](https://github.com/Netflix-Skunkworks/go-jira/commit/7e97463)]
|
||||||
|
* use `password-source-path` to allow overriding binary and/or path to binary [Cory Bennett] [[d6173ce](https://github.com/Netflix-Skunkworks/go-jira/commit/d6173ce)]
|
||||||
|
* allow issues on command line to automatically prefix with project when defined [Cory Bennett] [[d002d7f](https://github.com/Netflix-Skunkworks/go-jira/commit/d002d7f)]
|
||||||
|
* Forgot you use TAB instead of spaces [Cory Bennett] [[789886c](https://github.com/Netflix-Skunkworks/go-jira/commit/789886c)]
|
||||||
|
* Fixed append project to view [Cory Bennett] [[8a46215](https://github.com/Netflix-Skunkworks/go-jira/commit/8a46215)]
|
||||||
|
* Added a line break removal function [Cory Bennett] [[9cbd993](https://github.com/Netflix-Skunkworks/go-jira/commit/9cbd993)]
|
||||||
|
* Pushed Readfile to .jira.d directory instead of pwd [Cory Bennett] [[db53622](https://github.com/Netflix-Skunkworks/go-jira/commit/db53622)]
|
||||||
|
* Cache password to avoid invoking password source on each API request [Patrick Decat] [[0f059a5](https://github.com/Netflix-Skunkworks/go-jira/commit/0f059a5)]
|
||||||
|
* Add support to switch out password source binary [Patrick Pichler] [[659a5c8](https://github.com/Netflix-Skunkworks/go-jira/commit/659a5c8)]
|
||||||
|
* Add error handling to pass password-source [Patrick Pichler] [[3339303](https://github.com/Netflix-Skunkworks/go-jira/commit/3339303)]
|
||||||
|
* Add gopass support [Patrick Pichler] [[3c0a62e](https://github.com/Netflix-Skunkworks/go-jira/commit/3c0a62e)]
|
||||||
|
* add sprig template functions, replaces [[#215](https://github.com/Netflix-Skunkworks/go-jira/issues/215)] http://masterminds.github.io/sprig/ [Cory Bennett] [[719f7a6](https://github.com/Netflix-Skunkworks/go-jira/commit/719f7a6)]
|
||||||
|
* [[#232](https://github.com/Netflix-Skunkworks/go-jira/issues/232)] fix api to use common Version schema also rewrote the schema fetcher to use Go [Cory Bennett] [[90f01ce](https://github.com/Netflix-Skunkworks/go-jira/commit/90f01ce)]
|
||||||
|
* fix syntax [Cory Bennett] [[94dd489](https://github.com/Netflix-Skunkworks/go-jira/commit/94dd489)]
|
||||||
|
* 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)]
|
||||||
|
* [[#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/go-jira/jira, from gopkg.in [Mike Pountney] [[27f57b2](https://github.com/Netflix-Skunkworks/go-jira/commit/27f57b2)]
|
||||||
|
* Add 'pctOf' and 'fit' template functions [Adriano Caloiaro] [[027adee](https://github.com/Netflix-Skunkworks/go-jira/commit/027adee)]
|
||||||
|
* 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)]
|
||||||
|
|
||||||
|
## 1.0.23 - 2020-02-26
|
||||||
|
|
||||||
|
* update all usage of user.name to user.accountId for privacy migration: https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/ [Cory Bennett] [[a26683e](https://github.com/Netflix-Skunkworks/go-jira/commit/a26683e)]
|
||||||
|
* add template functions to handle table output, fixes [#176](https://github.com/Netflix-Skunkworks/go-jira/issues/176), replaces [#296](https://github.com/Netflix-Skunkworks/go-jira/issues/296) [Cory Bennett] [[7e97463](https://github.com/Netflix-Skunkworks/go-jira/commit/7e97463)]
|
||||||
|
* use `password-source-path` to allow overriding binary and/or path to binary [Cory Bennett] [[d6173ce](https://github.com/Netflix-Skunkworks/go-jira/commit/d6173ce)]
|
||||||
|
* allow issues on command line to automatically prefix with project when defined [Cory Bennett] [[d002d7f](https://github.com/Netflix-Skunkworks/go-jira/commit/d002d7f)]
|
||||||
|
* Forgot you use TAB instead of spaces [Cory Bennett] [[789886c](https://github.com/Netflix-Skunkworks/go-jira/commit/789886c)]
|
||||||
|
* Fixed append project to view [Cory Bennett] [[8a46215](https://github.com/Netflix-Skunkworks/go-jira/commit/8a46215)]
|
||||||
|
* Added a line break removal function [Cory Bennett] [[9cbd993](https://github.com/Netflix-Skunkworks/go-jira/commit/9cbd993)]
|
||||||
|
* Pushed Readfile to .jira.d directory instead of pwd [Cory Bennett] [[db53622](https://github.com/Netflix-Skunkworks/go-jira/commit/db53622)]
|
||||||
|
* Cache password to avoid invoking password source on each API request [Patrick Decat] [[0f059a5](https://github.com/Netflix-Skunkworks/go-jira/commit/0f059a5)]
|
||||||
|
* Add support to switch out password source binary [Patrick Pichler] [[659a5c8](https://github.com/Netflix-Skunkworks/go-jira/commit/659a5c8)]
|
||||||
|
* Add error handling to pass password-source [Patrick Pichler] [[3339303](https://github.com/Netflix-Skunkworks/go-jira/commit/3339303)]
|
||||||
|
* Add gopass support [Patrick Pichler] [[3c0a62e](https://github.com/Netflix-Skunkworks/go-jira/commit/3c0a62e)]
|
||||||
|
* add sprig template functions, replaces [[#215](https://github.com/Netflix-Skunkworks/go-jira/issues/215)] http://masterminds.github.io/sprig/ [Cory Bennett] [[719f7a6](https://github.com/Netflix-Skunkworks/go-jira/commit/719f7a6)]
|
||||||
|
* [[#232](https://github.com/Netflix-Skunkworks/go-jira/issues/232)] fix api to use common Version schema also rewrote the schema fetcher to use Go [Cory Bennett] [[90f01ce](https://github.com/Netflix-Skunkworks/go-jira/commit/90f01ce)]
|
||||||
|
|
||||||
|
## 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/go-jira/jira, from gopkg.in [Mike Pountney] [[27f57b2](https://github.com/Netflix-Skunkworks/go-jira/commit/27f57b2)]
|
||||||
|
* fix worklog template to allow multiline comments [Matthias Bethke] [[43e07f1](https://github.com/Netflix-Skunkworks/go-jira/commit/43e07f1)]
|
||||||
|
* Allow reading password from stdin [Justin Ko] [[225e1dc](https://github.com/Netflix-Skunkworks/go-jira/commit/225e1dc)]
|
||||||
|
* all: unindent some code [Daniel Martí] [[31c113d](https://github.com/Netflix-Skunkworks/go-jira/commit/31c113d)]
|
||||||
|
* don't use ReadAll when decoding JSON [Daniel Martí] [[9bcdcc1](https://github.com/Netflix-Skunkworks/go-jira/commit/9bcdcc1)]
|
||||||
|
* start making staticcheck happier [Daniel Martí] [[9b9186f](https://github.com/Netflix-Skunkworks/go-jira/commit/9b9186f)]
|
||||||
|
* all: convert to a Go module [Daniel Martí] [[f125ef3](https://github.com/Netflix-Skunkworks/go-jira/commit/f125ef3)]
|
||||||
|
* CI: test on Go 1.12.x, cleanup [Daniel Martí] [[664c5ca](https://github.com/Netflix-Skunkworks/go-jira/commit/664c5ca)]
|
||||||
|
* make automatic pagination on search optional, fix tests [Cory Bennett] [[36c99ce](https://github.com/Netflix-Skunkworks/go-jira/commit/36c99ce)]
|
||||||
|
* prefer defer resp.Body.Close to avoid leaks on subsequent errors [Cory Bennett] [[181bd74](https://github.com/Netflix-Skunkworks/go-jira/commit/181bd74)]
|
||||||
|
* add pagination to search [Miles Maddox] [[76dd1d8](https://github.com/Netflix-Skunkworks/go-jira/commit/76dd1d8)]
|
||||||
|
* Fix function comments based on best practices from Effective Go [CodeLingo Bot] [[23ac118](https://github.com/Netflix-Skunkworks/go-jira/commit/23ac118)]
|
||||||
|
* [[#201](https://github.com/Netflix-Skunkworks/go-jira/issues/201)] update required library, failing to populate cookiejar from cookies file [Cory Bennett] [[ee69afa](https://github.com/Netflix-Skunkworks/go-jira/commit/ee69afa)]
|
||||||
|
|
||||||
|
## 1.0.20 - 2018-08-04
|
||||||
|
|
||||||
|
* [[#201](https://github.com/Netflix-Skunkworks/go-jira/issues/201)] update required library, failing to populate cookiejar from cookies file [Cory Bennett] [[ee69afa](https://github.com/Netflix-Skunkworks/go-jira/commit/ee69afa)]
|
||||||
|
|
||||||
|
## 1.0.19 - 2018-08-02
|
||||||
|
|
||||||
|
* [[#199](https://github.com/Netflix-Skunkworks/go-jira/issues/199)] [[#198](https://github.com/Netflix-Skunkworks/go-jira/issues/198)] update http client library, fix issues with internal login retries [Cory Bennett] [[0cba806](https://github.com/Netflix-Skunkworks/go-jira/commit/0cba806)]
|
||||||
|
|
||||||
|
## 1.0.18 - 2018-07-29
|
||||||
|
|
||||||
|
* [[#196](https://github.com/Netflix-Skunkworks/go-jira/issues/196)] add `jira session` command to show session information if user is authenticated [Cory Bennett] [[f592107](https://github.com/Netflix-Skunkworks/go-jira/commit/f592107)]
|
||||||
|
* [[#192](https://github.com/Netflix-Skunkworks/go-jira/issues/192)] fix template usage for 'fixVersions' in transition template [Cory Bennett] [[c9a4e30](https://github.com/Netflix-Skunkworks/go-jira/commit/c9a4e30)]
|
||||||
|
* move HandleExit to the jiracli package [Cory Bennett] [[ef9b731](https://github.com/Netflix-Skunkworks/go-jira/commit/ef9b731)]
|
||||||
|
* they broke golang.org/x/net: ERROR: vendor/golang.org/x/net/proxy/socks5.go:11:2: use of internal package not allowed [Cory Bennett] [[7191c77](https://github.com/Netflix-Skunkworks/go-jira/commit/7191c77)]
|
||||||
|
* udpate deps [Cory Bennett] [[d16bcc2](https://github.com/Netflix-Skunkworks/go-jira/commit/d16bcc2)]
|
||||||
|
* udpate for figtree api changes [Cory Bennett] [[07ba74b](https://github.com/Netflix-Skunkworks/go-jira/commit/07ba74b)]
|
||||||
|
* udpate to use latest dep, update figtree [Cory Bennett] [[462ef1c](https://github.com/Netflix-Skunkworks/go-jira/commit/462ef1c)]
|
||||||
|
* [[#171](https://github.com/Netflix-Skunkworks/go-jira/issues/171)] change proposed PasswordPath to PasswordName [Cory Bennett] [[213a7e0](https://github.com/Netflix-Skunkworks/go-jira/commit/213a7e0)]
|
||||||
|
* add pass path to config [dvogt23] [[fa01ff5](https://github.com/Netflix-Skunkworks/go-jira/commit/fa01ff5)]
|
||||||
|
|
||||||
|
## 1.0.17 - 2018-04-15
|
||||||
|
|
||||||
|
* fix IsTerminal usage for windows [Cory Bennett] [[7f9595c](https://github.com/Netflix-Skunkworks/go-jira/commit/7f9595c)]
|
||||||
|
* [[#166](https://github.com/Netflix-Skunkworks/go-jira/issues/166)] fix issue when editing templates specified with full path [Cory Bennett] [[d787ac0](https://github.com/Netflix-Skunkworks/go-jira/commit/d787ac0)]
|
||||||
|
* only prompt on logout if stdin and stdout are terminals [Cory Bennett] [[09a61c3](https://github.com/Netflix-Skunkworks/go-jira/commit/09a61c3)]
|
||||||
|
* [[#163](https://github.com/Netflix-Skunkworks/go-jira/issues/163)] fix url path join logic [Cory Bennett] [[9146346](https://github.com/Netflix-Skunkworks/go-jira/commit/9146346)]
|
||||||
|
* [[#160](https://github.com/Netflix-Skunkworks/go-jira/issues/160)] prompt when api-token is invalid to get new token [Cory Bennett] [[e639cce](https://github.com/Netflix-Skunkworks/go-jira/commit/e639cce)]
|
||||||
|
* [[#157](https://github.com/Netflix-Skunkworks/go-jira/issues/157)] add `password-directory: path` to allow overriding PASSWORD_STORE_DIR from configs [Cory Bennett] [[06b26c9](https://github.com/Netflix-Skunkworks/go-jira/commit/06b26c9)]
|
||||||
|
* [[#160](https://github.com/Netflix-Skunkworks/go-jira/issues/160)] allow `jira logout` to delete your api-token from keychain [Cory Bennett] [[bd3cf99](https://github.com/Netflix-Skunkworks/go-jira/commit/bd3cf99)]
|
||||||
|
|
||||||
|
## 1.0.16 - 2018-04-01
|
||||||
|
|
||||||
|
* [[#159](https://github.com/Netflix-Skunkworks/go-jira/issues/159)] fix `slice bounds out of range` error in `abbrev` template function [Cory Bennett] [[359bec2](https://github.com/Netflix-Skunkworks/go-jira/commit/359bec2)]
|
||||||
|
* [[#158](https://github.com/Netflix-Skunkworks/go-jira/issues/158)] always print usage to stdout [Cory Bennett] [[79c83f6](https://github.com/Netflix-Skunkworks/go-jira/commit/79c83f6)]
|
||||||
|
|
||||||
|
## 1.0.15 - 2018-03-08
|
||||||
|
|
||||||
|
* [[#147](https://github.com/Netflix-Skunkworks/go-jira/issues/147)] [[#148](https://github.com/Netflix-Skunkworks/go-jira/issues/148)] add support for api token based authentication [Cory Bennett] [[edb0662](https://github.com/Netflix-Skunkworks/go-jira/commit/edb0662)]
|
||||||
|
* refactor to simplify main [Cory Bennett] [[43ebc84](https://github.com/Netflix-Skunkworks/go-jira/commit/43ebc84)] [[0d7c1a7](https://github.com/Netflix-Skunkworks/go-jira/commit/0d7c1a7)]
|
||||||
|
* [[#145](https://github.com/Netflix-Skunkworks/go-jira/issues/145)] fix to match AuthProvider interface [Cory Bennett] [[80325a5](https://github.com/Netflix-Skunkworks/go-jira/commit/80325a5)]
|
||||||
|
* [[#141](https://github.com/Netflix-Skunkworks/go-jira/issues/141)] better handling in responseError for non-json error responses [Cory Bennett] [[20a9666](https://github.com/Netflix-Skunkworks/go-jira/commit/20a9666)]
|
||||||
|
* Update unexportTemplates.go [GitHub] [[6da9974](https://github.com/Netflix-Skunkworks/go-jira/commit/6da9974)]
|
||||||
|
* [[#139](https://github.com/Netflix-Skunkworks/go-jira/issues/139)] add shellquote and toMinJson template functions [Cory Bennett] [[8c7ca38](https://github.com/Netflix-Skunkworks/go-jira/commit/8c7ca38)]
|
||||||
|
* [[#137](https://github.com/Netflix-Skunkworks/go-jira/issues/137)] update kingpeon dep to allow access to dynamic command structure [Cory Bennett] [[425fa63](https://github.com/Netflix-Skunkworks/go-jira/commit/425fa63)]
|
||||||
|
* field name is "comment" not "comments" [Cory Bennett] [[464742c](https://github.com/Netflix-Skunkworks/go-jira/commit/464742c)]
|
||||||
|
|
||||||
|
## 1.0.14 - 2017-11-04
|
||||||
|
|
||||||
|
* [[#131](https://github.com/Netflix-Skunkworks/go-jira/issues/131)] fix parsing global options before command execution (allow unixproxy/socksproxy to be set in config.yml) [Cory Bennett] [[042bc48](https://github.com/Netflix-Skunkworks/go-jira/commit/042bc48)]
|
||||||
|
* add/update deps [Cory Bennett] [[a2e36e8](https://github.com/Netflix-Skunkworks/go-jira/commit/a2e36e8)]
|
||||||
|
* add support for using socks proxy [onionjake] [[ff985f9](https://github.com/Netflix-Skunkworks/go-jira/commit/ff985f9)]
|
||||||
|
|
||||||
|
## 1.0.13 - 2017-10-28
|
||||||
|
|
||||||
|
* fix transition command [Cory Bennett] [[9597f9b](https://github.com/Netflix-Skunkworks/go-jira/commit/9597f9b)]
|
||||||
|
* fix default values to load after parsing configs [Cory Bennett] [[c9b5054](https://github.com/Netflix-Skunkworks/go-jira/commit/c9b5054)]
|
||||||
|
* add test to make sure IssueType.Fields does not disappear on regeneration [Cory Bennett] [[3966def](https://github.com/Netflix-Skunkworks/go-jira/commit/3966def)]
|
||||||
|
* add tests for validating changes to auto-generated jiradata files [Cory Bennett] [[41d1a7c](https://github.com/Netflix-Skunkworks/go-jira/commit/41d1a7c)]
|
||||||
|
* Fix typo in 'logout' command help [Cory Bennett] [[9000777](https://github.com/Netflix-Skunkworks/go-jira/commit/9000777)]
|
||||||
|
* Add URL escaping to an additional issuetype call [Cory Bennett] [[7bfa241](https://github.com/Netflix-Skunkworks/go-jira/commit/7bfa241)]
|
||||||
|
* Add --resolution option [Cory Bennett] [[e6600cf](https://github.com/Netflix-Skunkworks/go-jira/commit/e6600cf)]
|
||||||
|
* Create Metadata Not Populated Correctly [Dillon Buchanan] [[093c510](https://github.com/Netflix-Skunkworks/go-jira/commit/093c510)]
|
||||||
|
* add regexReplace template function [Dirk Heilig] [[d3e294e](https://github.com/Netflix-Skunkworks/go-jira/commit/d3e294e)]
|
||||||
|
|
||||||
|
## 1.0.12 - 2017-10-04
|
||||||
|
|
||||||
|
* add `{{env.VARNAME}}` template support to allow use of env vars [Cory Bennett] [[4d74554](https://github.com/Netflix-Skunkworks/go-jira/commit/4d74554)]
|
||||||
|
|
||||||
|
## 1.0.11 - 2017-09-26
|
||||||
|
|
||||||
|
* [[#115](https://github.com/Netflix-Skunkworks/go-jira/issues/115)] fix transition template for description [Cory Bennett] [[986cc78](https://github.com/Netflix-Skunkworks/go-jira/commit/986cc78)]
|
||||||
|
* update edit command to set queryFields on search to match what is used in template [Cory Bennett] [[3913726](https://github.com/Netflix-Skunkworks/go-jira/commit/3913726)]
|
||||||
|
* fix edit with query loop, allow continuation when not submitting previous issue [Cory Bennett] [[0ba8aa0](https://github.com/Netflix-Skunkworks/go-jira/commit/0ba8aa0)]
|
||||||
|
* fix edit when priority is not set [Cory Bennett] [[098eb99](https://github.com/Netflix-Skunkworks/go-jira/commit/098eb99)]
|
||||||
|
* flatten CommandRegistry list to make it more readable [Cory Bennett] [[2ddaed2](https://github.com/Netflix-Skunkworks/go-jira/commit/2ddaed2)]
|
||||||
|
|
||||||
|
## 1.0.10 - 2017-09-18
|
||||||
|
|
||||||
|
* clean up usage formatting, print aliases [Cory Bennett] [[9f433ac](https://github.com/Netflix-Skunkworks/go-jira/commit/9f433ac)]
|
||||||
|
* fix edit [Cory Bennett] [[4c6b36c](https://github.com/Netflix-Skunkworks/go-jira/commit/4c6b36c)]
|
||||||
|
* fix named query template expansion [Cory Bennett] [[a8eaa97](https://github.com/Netflix-Skunkworks/go-jira/commit/a8eaa97)]
|
||||||
|
* fix usage message [Cory Bennett] [[cd3cfd8](https://github.com/Netflix-Skunkworks/go-jira/commit/cd3cfd8)]
|
||||||
|
|
||||||
|
## 1.0.9 - 2017-09-17
|
||||||
|
|
||||||
|
* need issuetype to use the default list table template now [Cory Bennett] [[3e8b9bd](https://github.com/Netflix-Skunkworks/go-jira/commit/3e8b9bd)]
|
||||||
|
* [[#102](https://github.com/Netflix-Skunkworks/go-jira/issues/102)] add issuetype into the default queryfields and add it to the default `table` list template [Cory Bennett] [[c9d8dfb](https://github.com/Netflix-Skunkworks/go-jira/commit/c9d8dfb)]
|
||||||
|
|
||||||
|
## 1.0.8 - 2017-09-17
|
||||||
|
|
||||||
|
* [[#100](https://github.com/Netflix-Skunkworks/go-jira/issues/100)] add support for posting, fetching, listing and removing attachments [Cory Bennett] [[66eb7bf](https://github.com/Netflix-Skunkworks/go-jira/commit/66eb7bf)]
|
||||||
|
|
||||||
|
## 1.0.7 - 2017-09-15
|
||||||
|
|
||||||
|
* [[#87](https://github.com/Netflix-Skunkworks/go-jira/issues/87)] add various commands for interacting with epics [Cory Bennett] [[893454f](https://github.com/Netflix-Skunkworks/go-jira/commit/893454f)]
|
||||||
|
|
||||||
|
## 1.0.6 - 2017-09-13
|
||||||
|
|
||||||
|
* tweaks for templates in named queries to work better [Cory Bennett] [[00cba79](https://github.com/Netflix-Skunkworks/go-jira/commit/00cba79)]
|
||||||
|
* [[#99](https://github.com/Netflix-Skunkworks/go-jira/issues/99)] add support for named queries to be stored in configs [Cory Bennett] [[fb43753](https://github.com/Netflix-Skunkworks/go-jira/commit/fb43753)]
|
||||||
|
* [[#98](https://github.com/Netflix-Skunkworks/go-jira/issues/98)] add `--status` option for JQL filter on status with `list` command [Cory Bennett] [[5da04c1](https://github.com/Netflix-Skunkworks/go-jira/commit/5da04c1)]
|
||||||
|
|
||||||
|
## 1.0.5 - 2017-09-11
|
||||||
|
|
||||||
|
* use --gjq for GJson Query to filter json response data [Cory Bennett] [[608e586](https://github.com/Netflix-Skunkworks/go-jira/commit/608e586)]
|
||||||
|
* fix field tag syntax [Cory Bennett] [[2c552ac](https://github.com/Netflix-Skunkworks/go-jira/commit/2c552ac)]
|
||||||
|
* add '{{jira}}' template macro to refer to path of currently running jira command [Cory Bennett] [[941824d](https://github.com/Netflix-Skunkworks/go-jira/commit/941824d)]
|
||||||
|
|
||||||
|
## 1.0.4 - 2017-09-08
|
||||||
|
|
||||||
|
* update deps for kingpeon update use os.exec instead of syscall.exec for windows [Cory Bennett] [[86b963b](https://github.com/Netflix-Skunkworks/go-jira/commit/86b963b)]
|
||||||
|
|
||||||
|
## 1.0.3 - 2017-09-06
|
||||||
|
|
||||||
|
* [[#66](https://github.com/Netflix-Skunkworks/go-jira/issues/66)] add --started option to `jira worklog add` to change the start time for worklog [Cory Bennett] [[e6faee1](https://github.com/Netflix-Skunkworks/go-jira/commit/e6faee1)]
|
||||||
|
* [[#45](https://github.com/Netflix-Skunkworks/go-jira/issues/45)] automatically add comment to issue even if transition does not support comment updates during transtion [Cory Bennett] [[c4be59c](https://github.com/Netflix-Skunkworks/go-jira/commit/c4be59c)]
|
||||||
|
|
||||||
|
## 1.0.2 - 2017-09-06
|
||||||
|
|
||||||
|
* update dependencies [Cory Bennett] [[aa876cd](https://github.com/Netflix-Skunkworks/go-jira/commit/aa876cd)]
|
||||||
|
* update for github.com/AlecAivazis/survey => gopkg.in/AlecAivazis/survey.v1 package [Cory Bennett] [[9453179](https://github.com/Netflix-Skunkworks/go-jira/commit/9453179)]
|
||||||
|
* use stdout to determin output terminal size [Cory Bennett] [[4d79af4](https://github.com/Netflix-Skunkworks/go-jira/commit/4d79af4)]
|
||||||
|
|
||||||
|
## 1.0.1 - 2017-09-06
|
||||||
|
|
||||||
|
* [[#13](https://github.com/Netflix-Skunkworks/go-jira/issues/13)] change default input syntax to not require escaping for special characters [Cory Bennett] [[1106558](https://github.com/Netflix-Skunkworks/go-jira/commit/1106558)]
|
||||||
|
|
||||||
|
## 1.0.0 - 2017-09-05
|
||||||
|
|
||||||
|
* fix build for windows [Cory Bennett] [[1b854da](https://github.com/Netflix-Skunkworks/go-jira/commit/1b854da)]
|
||||||
|
* change the default log output format [Cory Bennett] [[f1b8c64](https://github.com/Netflix-Skunkworks/go-jira/commit/f1b8c64)]
|
||||||
|
* tweak auto-login so it does not print the standard `jira login` command output [Cory Bennett] [[49f6cdc](https://github.com/Netflix-Skunkworks/go-jira/commit/49f6cdc)]
|
||||||
|
* add --quiet global option [Cory Bennett] [[c226077](https://github.com/Netflix-Skunkworks/go-jira/commit/c226077)]
|
||||||
|
* refactor to allow for --insecure and --unixproxy arguments [Cory Bennett] [[c0358eb](https://github.com/Netflix-Skunkworks/go-jira/commit/c0358eb)]
|
||||||
|
* handle html response on expired cookies (require X-Ausername header to always be present) [Cory Bennett] [[21920c5](https://github.com/Netflix-Skunkworks/go-jira/commit/21920c5)]
|
||||||
|
* allow login prompt to be interrupted [Cory Bennett] [[7ab6c22](https://github.com/Netflix-Skunkworks/go-jira/commit/7ab6c22)]
|
||||||
|
* fmt -> log typo [Cory Bennett] [[bccf09f](https://github.com/Netflix-Skunkworks/go-jira/commit/bccf09f)]
|
||||||
|
* make ~/.jira.d directory if not already present [Cory Bennett] [[e72479c](https://github.com/Netflix-Skunkworks/go-jira/commit/e72479c)]
|
||||||
|
* fix go vet [Cory Bennett] [[e04b506](https://github.com/Netflix-Skunkworks/go-jira/commit/e04b506)]
|
||||||
|
* fix tests [Cory Bennett] [[ba35f55](https://github.com/Netflix-Skunkworks/go-jira/commit/ba35f55)]
|
||||||
|
* add OK printf [Cory Bennett] [[dc02181](https://github.com/Netflix-Skunkworks/go-jira/commit/dc02181)]
|
||||||
|
* change --method to use -M for backwards compat [Cory Bennett] [[b120c0b](https://github.com/Netflix-Skunkworks/go-jira/commit/b120c0b)]
|
||||||
|
* add resolution to dup'd issues when necessary [Cory Bennett] [[2638396](https://github.com/Netflix-Skunkworks/go-jira/commit/2638396)]
|
||||||
|
* call correct function for `labels remove|set` commands [Cory Bennett] [[ad1a62a](https://github.com/Netflix-Skunkworks/go-jira/commit/ad1a62a)]
|
||||||
|
* data argument is optional (for GET and DELETE requests) [Cory Bennett] [[4b60313](https://github.com/Netflix-Skunkworks/go-jira/commit/4b60313)]
|
||||||
|
* fix usage, overrides not serialized correctly [Cory Bennett] [[84119a2](https://github.com/Netflix-Skunkworks/go-jira/commit/84119a2)]
|
||||||
|
* fix `jira ISSUE-123` command line parsing [Cory Bennett] [[fa4ac25](https://github.com/Netflix-Skunkworks/go-jira/commit/fa4ac25)]
|
||||||
|
* add logger object to jiracmd [Cory Bennett] [[aed952b](https://github.com/Netflix-Skunkworks/go-jira/commit/aed952b)]
|
||||||
|
* refactor for GlobalOptions and CommonOptions [Cory Bennett] [[979da1f](https://github.com/Netflix-Skunkworks/go-jira/commit/979da1f)]
|
||||||
|
* move commands from jiracli package to jiracmd package [Cory Bennett] [[0a5510b](https://github.com/Netflix-Skunkworks/go-jira/commit/0a5510b)]
|
||||||
|
* use jiracli.Error object to disambiguate between kingpin errors and cli errors [Cory Bennett] [[fb1bfeb](https://github.com/Netflix-Skunkworks/go-jira/commit/fb1bfeb)]
|
||||||
|
* fix stray newline for list table template [Cory Bennett] [[36c26c5](https://github.com/Netflix-Skunkworks/go-jira/commit/36c26c5)]
|
||||||
|
* fix dynamic table output when not on tty [Cory Bennett] [[3942f6f](https://github.com/Netflix-Skunkworks/go-jira/commit/3942f6f)]
|
||||||
|
* when using --verbose set the JIRA_DEBUG environment variable so custom-commands can auto enable verbose output [Cory Bennett] [[da9a2b2](https://github.com/Netflix-Skunkworks/go-jira/commit/da9a2b2)]
|
||||||
|
* make `jira ISSUE-123` usage call `jira view ISSUE-123` [Cory Bennett] [[ec0858b](https://github.com/Netflix-Skunkworks/go-jira/commit/ec0858b)]
|
||||||
|
* integrate kingpeon library to allow for custom commands via configuration [Cory Bennett] [[301a61f](https://github.com/Netflix-Skunkworks/go-jira/commit/301a61f)]
|
||||||
|
* use terminal width to adjust list table output [Cory Bennett] [[2a081dd](https://github.com/Netflix-Skunkworks/go-jira/commit/2a081dd)]
|
||||||
|
* set yaml/json tags for option structs [Cory Bennett] [[f52d2c4](https://github.com/Netflix-Skunkworks/go-jira/commit/f52d2c4)]
|
||||||
|
* update generated data files [Cory Bennett] [[c89f11d](https://github.com/Netflix-Skunkworks/go-jira/commit/c89f11d)]
|
||||||
|
* automatically login when anonymous user detected [Cory Bennett] [[21add54](https://github.com/Netflix-Skunkworks/go-jira/commit/21add54)]
|
||||||
|
* refactor trivial objects in favor of arguments to static functions [Cory Bennett] [[1f345ce](https://github.com/Netflix-Skunkworks/go-jira/commit/1f345ce)]
|
||||||
|
* set JIRA_OPERATION when parsing configs. Use figtree config types for options to make defaulting work [Cory Bennett] [[5716a7c](https://github.com/Netflix-Skunkworks/go-jira/commit/5716a7c)]
|
||||||
|
* add better handing for usage error [Cory Bennett] [[b235dcc](https://github.com/Netflix-Skunkworks/go-jira/commit/b235dcc)]
|
||||||
|
* adding `request` command, removing dead code [Cory Bennett] [[56b1c9d](https://github.com/Netflix-Skunkworks/go-jira/commit/56b1c9d)]
|
||||||
|
* adding Do required for request language [Cory Bennett] [[a1c2849](https://github.com/Netflix-Skunkworks/go-jira/commit/a1c2849)]
|
||||||
|
* add `browse` command and implement -b option for most operations [Cory Bennett] [[a91b9d5](https://github.com/Netflix-Skunkworks/go-jira/commit/a91b9d5)]
|
||||||
|
* fix IssueAssign [Cory Bennett] [[f32cc70](https://github.com/Netflix-Skunkworks/go-jira/commit/f32cc70)]
|
||||||
|
* merge in update for upstream changes [#104](https://github.com/Netflix-Skunkworks/go-jira/issues/104) [Cory Bennett] [[19d8686](https://github.com/Netflix-Skunkworks/go-jira/commit/19d8686)]
|
||||||
|
* add `export-templates` command [Cory Bennett] [[abaad56](https://github.com/Netflix-Skunkworks/go-jira/commit/abaad56)]
|
||||||
|
* add `issuetypes` command [Cory Bennett] [[da39323](https://github.com/Netflix-Skunkworks/go-jira/commit/da39323)]
|
||||||
|
* add `components` command [Cory Bennett] [[0bd3ca2](https://github.com/Netflix-Skunkworks/go-jira/commit/0bd3ca2)]
|
||||||
|
* add `component add` command [Cory Bennett] [[cc90610](https://github.com/Netflix-Skunkworks/go-jira/commit/cc90610)]
|
||||||
|
* add `take`, `unassign` and `assign|give` commands [Cory Bennett] [[959524a](https://github.com/Netflix-Skunkworks/go-jira/commit/959524a)]
|
||||||
|
* adding `labels [add|set|remove]` commands [Cory Bennett] [[9161861](https://github.com/Netflix-Skunkworks/go-jira/commit/9161861)]
|
||||||
|
* add `comment` command [Cory Bennett] [[f0b08c5](https://github.com/Netflix-Skunkworks/go-jira/commit/f0b08c5)]
|
||||||
|
* add `watch` command [Cory Bennett] [[ec0ac3c](https://github.com/Netflix-Skunkworks/go-jira/commit/ec0ac3c)]
|
||||||
|
* add `rank ISSUE after|before ISSUE` command [Cory Bennett] [[8b863d2](https://github.com/Netflix-Skunkworks/go-jira/commit/8b863d2)]
|
||||||
|
* add `vote` command [Cory Bennett] [[a08c92f](https://github.com/Netflix-Skunkworks/go-jira/commit/a08c92f)]
|
||||||
|
* add `issuelinktypes` command [Cory Bennett] [[37f81a4](https://github.com/Netflix-Skunkworks/go-jira/commit/37f81a4)]
|
||||||
|
* add `issuelink` command [Cory Bennett] [[aacc9f4](https://github.com/Netflix-Skunkworks/go-jira/commit/aacc9f4)]
|
||||||
|
* fix closing duplicate issue on `dup` command [Cory Bennett] [[fc696c3](https://github.com/Netflix-Skunkworks/go-jira/commit/fc696c3)]
|
||||||
|
* rewrite checkpoint [Cory Bennett] [[36632a5](https://github.com/Netflix-Skunkworks/go-jira/commit/36632a5)]
|
||||||
|
|
||||||
|
## 0.1.14 - 2017-05-10
|
||||||
|
|
||||||
|
* fix unsafe casting for --quiet flag [Cory Bennett] [[6f29f43](https://github.com/Netflix-Skunkworks/go-jira/commit/6f29f43)]
|
||||||
|
* [[#80](https://github.com/Netflix-Skunkworks/go-jira/issues/80)] add `jira unassign` and `jira give ISSUE --default` commands [Cory Bennett] [[03d8633](https://github.com/Netflix-Skunkworks/go-jira/commit/03d8633)]
|
||||||
|
|
||||||
|
## 0.1.13 - 2017-04-24
|
||||||
|
|
||||||
|
* work around `github.com/tmc/keyring` compile error for windows [Cory Bennett] [[85298e9](https://github.com/Netflix-Skunkworks/go-jira/commit/85298e9)]
|
||||||
|
* Added generic issuelink command [David Reuss] [[cc54d11](https://github.com/Netflix-Skunkworks/go-jira/commit/cc54d11)]
|
||||||
|
* Added --start parameter for pagination on results [David Reuss] [[9b94d9e](https://github.com/Netflix-Skunkworks/go-jira/commit/9b94d9e)]
|
||||||
|
|
||||||
|
## 0.1.12 - 2017-03-22
|
||||||
|
|
||||||
|
* Implement "browse" subcommand on Windows [Claus Brod] [[ca333d8](https://github.com/Netflix-Skunkworks/go-jira/commit/ca333d8)]
|
||||||
|
|
||||||
|
## 0.1.11 - 2017-02-26
|
||||||
|
|
||||||
|
* [[#69](https://github.com/Netflix-Skunkworks/go-jira/issues/69)] add subtask command [Cory Bennett] [[21a2ed5](https://github.com/Netflix-Skunkworks/go-jira/commit/21a2ed5)]
|
||||||
|
|
||||||
|
## 0.1.10 - 2017-02-08
|
||||||
|
|
||||||
|
* set GPG_TTY in .bashrc [Cory Bennett] [[b1e552f](https://github.com/Netflix-Skunkworks/go-jira/commit/b1e552f)]
|
||||||
|
* force password in case password already exists [Cory Bennett] [[d5a2c3b](https://github.com/Netflix-Skunkworks/go-jira/commit/d5a2c3b)]
|
||||||
|
* refactor password source, allow for "pass" to be used, update tests to use `password-source: pass` [Cory Bennett] [[5a71939](https://github.com/Netflix-Skunkworks/go-jira/commit/5a71939)]
|
||||||
|
|
||||||
|
## 0.1.9 - 2016-12-18
|
||||||
|
|
||||||
|
* only warn about needing login when not already running the login command [Cory Bennett] [[6c24e55](https://github.com/Netflix-Skunkworks/go-jira/commit/6c24e55)]
|
||||||
|
* fix(http): Add proxy transport [William Hearn] [[4bd740b](https://github.com/Netflix-Skunkworks/go-jira/commit/4bd740b)] [[2dff6c9](https://github.com/Netflix-Skunkworks/go-jira/commit/2dff6c9)]
|
||||||
|
|
||||||
|
## 0.1.8 - 2016-11-24
|
||||||
|
|
||||||
|
* [[#12](https://github.com/Netflix-Skunkworks/go-jira/issues/12)] integrate with keyring for password storage and provide http basic auth credentials for every request since most jira services have websudo enabled with does not allow cookie based authentication [Cory Bennett] [[b8a6e57](https://github.com/Netflix-Skunkworks/go-jira/commit/b8a6e57)]
|
||||||
|
* Cleaning up usage [Jay Shirley] [[8add52b](https://github.com/Netflix-Skunkworks/go-jira/commit/8add52b)]
|
||||||
|
* Update usage [Jay Shirley] [[b56e32a](https://github.com/Netflix-Skunkworks/go-jira/commit/b56e32a)]
|
||||||
|
* use gopkg.in for links to maintain version compatibility [Cory Bennett] [[1414d1f](https://github.com/Netflix-Skunkworks/go-jira/commit/1414d1f)]
|
||||||
|
* golint [Cory Bennett] [[44cdebf](https://github.com/Netflix-Skunkworks/go-jira/commit/44cdebf)]
|
||||||
|
* add "rank" command allow ordering backlog issues in agile projects [Cory Bennett] [[e4cc9c6](https://github.com/Netflix-Skunkworks/go-jira/commit/e4cc9c6)]
|
||||||
|
* Adding a unixproxy mechanism [Jay Shirley] [[5b9c0dd](https://github.com/Netflix-Skunkworks/go-jira/commit/5b9c0dd)]
|
||||||
|
|
||||||
|
## 0.1.7 - 2016-08-24
|
||||||
|
|
||||||
|
* Prefer transition names which match exactly [Don Brower] [[e40f9c1](https://github.com/Netflix-Skunkworks/go-jira/commit/e40f9c1)]
|
||||||
|
* update tempates to make them more readable with space trimming added to go-1.6 [Cory Bennett] [[693b3e4](https://github.com/Netflix-Skunkworks/go-jira/commit/693b3e4)]
|
||||||
|
|
||||||
|
## 0.1.6 - 2016-08-21
|
||||||
|
|
||||||
|
* make "worklogs" command print output through template allow "add worklog" command to open edit template [Cory Bennett] [[cc3fbee](https://github.com/Netflix-Skunkworks/go-jira/commit/cc3fbee)]
|
||||||
|
* remove extra newline at end of worklogs template [Cory Bennett] [[d08ef15](https://github.com/Netflix-Skunkworks/go-jira/commit/d08ef15)]
|
||||||
|
* adding worklog related templates [Cory Bennett] [[ab1cd27](https://github.com/Netflix-Skunkworks/go-jira/commit/ab1cd27)]
|
||||||
|
|
||||||
|
## 0.1.5 - 2016-08-21
|
||||||
|
|
||||||
|
* update for golint [Cory Bennett] [[5a4e17c](https://github.com/Netflix-Skunkworks/go-jira/commit/5a4e17c)]
|
||||||
|
* fix for go vet [Cory Bennett] [[355fb42](https://github.com/Netflix-Skunkworks/go-jira/commit/355fb42)]
|
||||||
|
|
||||||
|
## 0.1.4 - 2016-08-12
|
||||||
|
|
||||||
|
* when running "dups" on a Process Management Project type, you have to start/stop the task to resolve it [Cory Bennett] [[2c91905](https://github.com/Netflix-Skunkworks/go-jira/commit/2c91905)]
|
||||||
|
* allow for defaultResolution option for transition command [Cory Bennett] [[a328c2d](https://github.com/Netflix-Skunkworks/go-jira/commit/a328c2d)]
|
||||||
|
* add "backlog" command for Kanban related Issues [Cory Bennett] [[5d39b23](https://github.com/Netflix-Skunkworks/go-jira/commit/5d39b23)]
|
||||||
|
* fix --noedit flag with "dups" command [Cory Bennett] [[37c07fa](https://github.com/Netflix-Skunkworks/go-jira/commit/37c07fa)]
|
||||||
|
* add "votes" and "labels" to default view template [Cory Bennett] [[6f73b8c](https://github.com/Netflix-Skunkworks/go-jira/commit/6f73b8c)]
|
||||||
|
* add "blockerType" config param, for issueLinkType use for "blocks" command [Cory Bennett] [[30fd301](https://github.com/Netflix-Skunkworks/go-jira/commit/30fd301)]
|
||||||
|
* update gitter room [Cory Bennett] [[4b822b1](https://github.com/Netflix-Skunkworks/go-jira/commit/4b822b1)]
|
||||||
|
* default issuetype to "Bug" for project that have Bug, otherwise try "Task" [Cory Bennett] [[0c807b4](https://github.com/Netflix-Skunkworks/go-jira/commit/0c807b4)]
|
||||||
|
* make view template only show fields that have values [Cory Bennett] [[8238fe8](https://github.com/Netflix-Skunkworks/go-jira/commit/8238fe8)]
|
||||||
|
* make default create template only display fields if they are valid fields for the project [Cory Bennett] [[adc2ace](https://github.com/Netflix-Skunkworks/go-jira/commit/adc2ace)]
|
||||||
|
* ignore empty json fields when processing templates [Cory Bennett] [[f5f3e28](https://github.com/Netflix-Skunkworks/go-jira/commit/f5f3e28)]
|
||||||
|
* allow JIRA_LOG_FORMAT env variable to control log output format [Cory Bennett] [[469def0](https://github.com/Netflix-Skunkworks/go-jira/commit/469def0)]
|
||||||
|
* remove extraneous debug [Cory Bennett] [[752a94d](https://github.com/Netflix-Skunkworks/go-jira/commit/752a94d)]
|
||||||
|
* add logout command modify password prompt to echo masked password [Cory Bennett] [[8ad91be](https://github.com/Netflix-Skunkworks/go-jira/commit/8ad91be)]
|
||||||
|
* tweak cookies to store hostname dump all http request/response with --verbose [Cory Bennett] [[f93fe79](https://github.com/Netflix-Skunkworks/go-jira/commit/f93fe79)]
|
||||||
|
* load configs in order of closest to cwd (/etc/go-jira.yml is last) [Cory Bennett] [[f54267b](https://github.com/Netflix-Skunkworks/go-jira/commit/f54267b)]
|
||||||
|
|
||||||
|
## 0.1.3 - 2016-07-30
|
||||||
|
|
||||||
|
* [[#43](https://github.com/Netflix-Skunkworks/go-jira/issues/43)] add support for jira done|todo|prog commands [Cory Bennett] [[dd7d1cc](https://github.com/Netflix-Skunkworks/go-jira/commit/dd7d1cc)]
|
||||||
|
* Reporter is not generally editable. [Mike Pountney] [[a637b43](https://github.com/Netflix-Skunkworks/go-jira/commit/a637b43)]
|
||||||
|
|
||||||
|
## 0.1.2 - 2016-06-29
|
||||||
|
|
||||||
|
* [[#44](https://github.com/Netflix-Skunkworks/go-jira/issues/44)] Close tmpfile before rename to work around "The process cannot access the file because it is being used by another process" error on windows. [Cory Bennett] [[0980f8e](https://github.com/Netflix-Skunkworks/go-jira/commit/0980f8e)]
|
||||||
|
|
||||||
|
## 0.1.1 - 2016-06-28
|
||||||
|
|
||||||
|
* use USERPROFILE instead of HOME for windows, rework paths to use filepath.Join for better cross platform support [Cory Bennett] [[adcedc4](https://github.com/Netflix-Skunkworks/go-jira/commit/adcedc4)]
|
||||||
|
* Include templates from a system path [Mike Pountney] [[cf10f53](https://github.com/Netflix-Skunkworks/go-jira/commit/cf10f53)]
|
||||||
|
* Added support for the ```expand``` option for Issues [tobyjoe] [[fb4afc9](https://github.com/Netflix-Skunkworks/go-jira/commit/fb4afc9)]
|
||||||
|
* change for api changes to go-logging [Cory Bennett] [[7bfc6e8](https://github.com/Netflix-Skunkworks/go-jira/commit/7bfc6e8)]
|
||||||
|
* Fix issuetype calls adding URL escaping [Jonathan Wright] [[e4a25e2](https://github.com/Netflix-Skunkworks/go-jira/commit/e4a25e2)]
|
||||||
|
|
||||||
|
## 0.1.0 - 2016-01-29
|
||||||
|
|
||||||
|
* Fixes [#32](https://github.com/Netflix-Skunkworks/go-jira/issues/32) - make path to cookieFile if it's not present [Mike Pountney] [[6644579](https://github.com/Netflix-Skunkworks/go-jira/commit/6644579)]
|
||||||
|
* Add component/components support: add and list for now. [Mike Pountney] [[d7b3226](https://github.com/Netflix-Skunkworks/go-jira/commit/d7b3226)]
|
||||||
|
* Tweak the CmdWatch contract and add watcher remove support [Mike Pountney] [[383847a](https://github.com/Netflix-Skunkworks/go-jira/commit/383847a)]
|
||||||
|
* Amend vote/unvote to be vote/vote --down [Mike Pountney] [[797edef](https://github.com/Netflix-Skunkworks/go-jira/commit/797edef)]
|
||||||
|
* Add 'vote' and 'unvote' [Mike Pountney] [[c95e66e](https://github.com/Netflix-Skunkworks/go-jira/commit/c95e66e)]
|
||||||
|
|
||||||
|
## 0.0.20 - 2016-01-21
|
||||||
|
|
||||||
|
* [issue [#28](https://github.com/Netflix-Skunkworks/go-jira/issues/28)] check to make sure we got back issuetypes for create metadata [Cory Bennett] [[ee0e780](https://github.com/Netflix-Skunkworks/go-jira/commit/ee0e780)]
|
||||||
|
* Add insecure option for TLS endpoints [Brian Lalor] [[6a88bb9](https://github.com/Netflix-Skunkworks/go-jira/commit/6a88bb9)]
|
||||||
|
* Correct naming of parameter: set/add/remove are actions. [Mike Pountney] [[303784f](https://github.com/Netflix-Skunkworks/go-jira/commit/303784f)]
|
||||||
|
* Tweak CmdLabels args so that magic happens with CLI [Mike Pountney] [[40a7c65](https://github.com/Netflix-Skunkworks/go-jira/commit/40a7c65)]
|
||||||
|
* Expose ViewTicket as per FindIssues [Mike Pountney] [[8977f3d](https://github.com/Netflix-Skunkworks/go-jira/commit/8977f3d)]
|
||||||
|
* Add exposed versions of getTemplate and runTemplate [Mike Pountney] [[da6cbd5](https://github.com/Netflix-Skunkworks/go-jira/commit/da6cbd5)]
|
||||||
|
* Add 'labels' command to set/add/remove labels [Mike Pountney] [[230b52d](https://github.com/Netflix-Skunkworks/go-jira/commit/230b52d)]
|
||||||
|
* Add a 'join' func to the template engine [Mike Pountney] [[a7820fe](https://github.com/Netflix-Skunkworks/go-jira/commit/a7820fe)]
|
||||||
|
* make "jira" golang package, move code from jira/cli to root, move jira/main.go to main/main.go [Cory Bennett] [[7268b9e](https://github.com/Netflix-Skunkworks/go-jira/commit/7268b9e)]
|
||||||
|
|
||||||
|
## 0.0.19 - 2015-12-09
|
||||||
|
|
||||||
|
* fix jira trans TRANS ISSUE (case sensitivity issue), also go fmt [Cory Bennett] [[3c30f3b](https://github.com/Netflix-Skunkworks/go-jira/commit/3c30f3b)]
|
||||||
|
|
||||||
|
## 0.0.18 - 2015-12-03
|
||||||
|
|
||||||
|
* need to default "quiet" to false [Cory Bennett] [[4f4a89b](https://github.com/Netflix-Skunkworks/go-jira/commit/4f4a89b)]
|
||||||
|
|
||||||
|
## 0.0.17 - 2015-12-03
|
||||||
|
|
||||||
|
* add --quiet command to not print the OK .. add --saveFile option to print the issue/link to a file on create command [Cory Bennett] [[c9ac162](https://github.com/Netflix-Skunkworks/go-jira/commit/c9ac162)]
|
||||||
|
* fix overrides [Cory Bennett] [[eaddfe6](https://github.com/Netflix-Skunkworks/go-jira/commit/eaddfe6)]
|
||||||
|
* add abstract request wrapper to allow you to access/process random apis supported by Jira but not yet supported by go-jira [Cory Bennett] [[90ef56a](https://github.com/Netflix-Skunkworks/go-jira/commit/90ef56a)]
|
||||||
|
|
||||||
|
## 0.0.16 - 2015-11-23
|
||||||
|
|
||||||
|
* jira edit should not require one arguemnt (allow for --query) [Cory Bennett] [[a1eb4a1](https://github.com/Netflix-Skunkworks/go-jira/commit/a1eb4a1)]
|
||||||
|
|
||||||
|
## 0.0.15 - 2015-11-23
|
||||||
|
|
||||||
|
* [[#17](https://github.com/Netflix-Skunkworks/go-jira/issues/17)] print usage on missing arguments [Cory Bennett] [[fd2a2fe](https://github.com/Netflix-Skunkworks/go-jira/commit/fd2a2fe)]
|
||||||
|
|
||||||
|
## 0.0.14 - 2015-11-17
|
||||||
|
|
||||||
|
* s/enpoint/endpoint/g [Oliver Schrenk] [[c5d251d](https://github.com/Netflix-Skunkworks/go-jira/commit/c5d251d)]
|
||||||
|
* Implement dateFormat template command [Mike Pountney] [[68d3bae](https://github.com/Netflix-Skunkworks/go-jira/commit/68d3bae)]
|
||||||
|
* Add 'updated' field to default queryfields. [Mike Pountney] [[91e2475](https://github.com/Netflix-Skunkworks/go-jira/commit/91e2475)]
|
||||||
|
* Fix export-templates option (typo) [Mike Pountney] [[4d7fdb8](https://github.com/Netflix-Skunkworks/go-jira/commit/4d7fdb8)]
|
||||||
|
* when yaml element resolves to "\n" strip it out so we dont post it to jira [Cory Bennett] [[47ced2f](https://github.com/Netflix-Skunkworks/go-jira/commit/47ced2f)]
|
||||||
|
* print PUT/POST data when using --dryrun to help debug [Cory Bennett] [[618f245](https://github.com/Netflix-Skunkworks/go-jira/commit/618f245)]
|
||||||
|
|
||||||
|
## 0.0.13 - 2015-09-19
|
||||||
|
|
||||||
|
* replace dead/deprecated code.google.com/p/gopass with golang.org/x/crypto/ssh/terminal for reading password from stdin [Cory Bennett] [[909eb06](https://github.com/Netflix-Skunkworks/go-jira/commit/909eb06)]
|
||||||
|
|
||||||
|
## 0.0.12 - 2015-09-18
|
||||||
|
|
||||||
|
* fix exception from "jira create" [Cory Bennett] [[9348a4b](https://github.com/Netflix-Skunkworks/go-jira/commit/9348a4b)]
|
||||||
|
* add some debug messages to help diagnose login failures [Cory Bennett] [[1c08a7d](https://github.com/Netflix-Skunkworks/go-jira/commit/1c08a7d)]
|
||||||
|
|
||||||
|
## 0.0.11 - 2015-09-16
|
||||||
|
|
||||||
|
* add --version [Cory Bennett] [[8385ee2](https://github.com/Netflix-Skunkworks/go-jira/commit/8385ee2)]
|
||||||
|
* fix command line parser broken in 0.0.10 [Cory Bennett] [[15ae929](https://github.com/Netflix-Skunkworks/go-jira/commit/15ae929)]
|
||||||
|
|
||||||
|
## 0.0.10 - 2015-09-15
|
||||||
|
|
||||||
|
* allow for command aliasing in conjunction with executable config files. Issue #5 [Cory Bennett] [[23590d4](https://github.com/Netflix-Skunkworks/go-jira/commit/23590d4)]
|
||||||
|
* update usage [Cory Bennett] [[ef7a57e](https://github.com/Netflix-Skunkworks/go-jira/commit/ef7a57e)]
|
||||||
|
|
||||||
|
## 0.0.9 - 2015-09-15
|
||||||
|
|
||||||
|
* use forked yaml.v2 so as to not lose line terminations present in jira fields [Cory Bennett] [[f84e77f](https://github.com/Netflix-Skunkworks/go-jira/commit/f84e77f)]
|
||||||
|
* adding a |~ literal yaml syntax to just chomp a single newline (again to preserve existing formatting in jira fields) [Cory Bennett] [[f84e77f](https://github.com/Netflix-Skunkworks/go-jira/commit/f84e77f)]
|
||||||
|
* for indent/comment allow for unicode line termination characters that yaml will use for parsing [Cory Bennett] [[f84e77f](https://github.com/Netflix-Skunkworks/go-jira/commit/f84e77f)]
|
||||||
|
* fix "edit" default option, change how defaults are dealt with for filters [Cory Bennett] [[4265913](https://github.com/Netflix-Skunkworks/go-jira/commit/4265913)]
|
||||||
|
* for edit template add issue id as comment, also add "comments" as comment so you can review the comment details while editing [Cory Bennett] [[968a9df](https://github.com/Netflix-Skunkworks/go-jira/commit/968a9df)]
|
||||||
|
* add "comment" template filter to comment out multiline statements [Cory Bennett] [[d664868](https://github.com/Netflix-Skunkworks/go-jira/commit/d664868)]
|
||||||
|
* add getOpt wrappers to get options with defaults [Cory Bennett] [[c0070cf](https://github.com/Netflix-Skunkworks/go-jira/commit/c0070cf)]
|
||||||
|
* make --dryrun work [Cory Bennett] [[d229ac1](https://github.com/Netflix-Skunkworks/go-jira/commit/d229ac1)]
|
||||||
|
* refactor config/option loading so command options override settings in config files [Cory Bennett] [[d229ac1](https://github.com/Netflix-Skunkworks/go-jira/commit/d229ac1)]
|
||||||
|
* allow query options to be used on the "edit" command to iterate editing [Cory Bennett] [[d229ac1](https://github.com/Netflix-Skunkworks/go-jira/commit/d229ac1)]
|
||||||
|
* remove duplication for defaults [Cory Bennett] [[f8c8ddf](https://github.com/Netflix-Skunkworks/go-jira/commit/f8c8ddf)]
|
||||||
|
* use optigo for option parsing, drop docopt [Cory Bennett] [[7bbd571](https://github.com/Netflix-Skunkworks/go-jira/commit/7bbd571)]
|
||||||
|
* allow "abort: true" to be set while editing to cancel the edit operation [Cory Bennett] [[ea67a77](https://github.com/Netflix-Skunkworks/go-jira/commit/ea67a77)]
|
||||||
|
* if no changes are made on edit templates then abort edit [Cory Bennett] [[e69b65c](https://github.com/Netflix-Skunkworks/go-jira/commit/e69b65c)]
|
||||||
|
|
||||||
|
## 0.0.8 - 2015-07-31
|
||||||
|
|
||||||
|
* Add --max_results option for 'ls' [Mike Pountney] [[e06ff0c](https://github.com/Netflix-Skunkworks/go-jira/commit/e06ff0c)]
|
||||||
|
|
||||||
|
## 0.0.7 - 2015-07-01
|
||||||
|
|
||||||
|
* fix "take" command not honouring user option [Andrew Haigh] [[8f1d2b9](https://github.com/Netflix-Skunkworks/go-jira/commit/8f1d2b9)]
|
||||||
|
* fix typo [Cory Bennett] [[06f57fe](https://github.com/Netflix-Skunkworks/go-jira/commit/06f57fe)]
|
||||||
|
|
||||||
|
## 0.0.6 - 2015-02-27
|
||||||
|
|
||||||
|
* allow --sort= to disable sort override [Cory Bennett] [[701f091](https://github.com/Netflix-Skunkworks/go-jira/commit/701f091)]
|
||||||
|
* fix default JIRA_OPERATION env variable [Cory Bennett] [[82fd9b9](https://github.com/Netflix-Skunkworks/go-jira/commit/82fd9b9)]
|
||||||
|
* automatically close duplicate issues with "Duplicate" resolution [Cory Bennett] [[ebf1700](https://github.com/Netflix-Skunkworks/go-jira/commit/ebf1700)]
|
||||||
|
* set JIRA_OPERATION to "view" when no operation used (ie: jira GOJIRA-123) [Cory Bennett] [[050848a](https://github.com/Netflix-Skunkworks/go-jira/commit/050848a)]
|
||||||
|
* add --sort option to "list" command [Cory Bennett] [[f359030](https://github.com/Netflix-Skunkworks/go-jira/commit/f359030)]
|
||||||
|
|
||||||
|
## 0.0.5 - 2015-02-21
|
||||||
|
|
||||||
|
* handle editor having arguments [Cory Bennett] [[7186fb3](https://github.com/Netflix-Skunkworks/go-jira/commit/7186fb3)]
|
||||||
|
* add more template error handling [Cory Bennett] [[3e6f2b3](https://github.com/Netflix-Skunkworks/go-jira/commit/3e6f2b3)]
|
||||||
|
* allow create template to specify defalt watchers with -o watchers=... [Cory Bennett] [[4db2e4e](https://github.com/Netflix-Skunkworks/go-jira/commit/4db2e4e)]
|
||||||
|
* if config files are executable then run them and parse the output [Cory Bennett] [[7a2f7f5](https://github.com/Netflix-Skunkworks/go-jira/commit/7a2f7f5)]
|
||||||
|
|
||||||
|
## 0.0.4 - 2015-02-19
|
||||||
|
|
||||||
|
* add --template option to export-templates to export a single template [Cory Bennett] [[343fbb6](https://github.com/Netflix-Skunkworks/go-jira/commit/343fbb6)]
|
||||||
|
* add "table" template to be used with "list" command [Cory Bennett] [[8954ec1](https://github.com/Netflix-Skunkworks/go-jira/commit/8954ec1)]
|
||||||
|
|
||||||
|
## 0.0.3 - 2015-02-19
|
||||||
|
|
||||||
|
* [issue [#8](https://github.com/Netflix-Skunkworks/go-jira/issues/8)] detect X-Seraph-Loginreason: AUTHENTICATION_DENIED header to catch login failures [Cory Bennett] [[2dcf665](https://github.com/Netflix-Skunkworks/go-jira/commit/2dcf665)]
|
||||||
|
* project should always be uppercase [Jay Buffington] [[1b69d12](https://github.com/Netflix-Skunkworks/go-jira/commit/1b69d12)]
|
||||||
|
* if response is 400, check json for errorMessages and log them [Jay Buffington] [[4924dfa](https://github.com/Netflix-Skunkworks/go-jira/commit/4924dfa)]
|
||||||
|
* validate project [Jay Buffington] [[dc5ae42](https://github.com/Netflix-Skunkworks/go-jira/commit/dc5ae42)]
|
||||||
|
|
||||||
|
## 0.0.2 - 2015-02-18
|
||||||
|
|
||||||
|
* add missing --override options on transition command
|
||||||
|
* add browse command
|
||||||
|
|
||||||
|
## 0.0.1 - 2015-02-18
|
||||||
|
|
||||||
|
* Initial experimental release
|
||||||
@@ -1,20 +1,5 @@
|
|||||||
PLATFORMS= \
|
|
||||||
freebsd/amd64 \
|
|
||||||
linux/386 \
|
|
||||||
linux/amd64 \
|
|
||||||
windows/386 \
|
|
||||||
windows/amd64 \
|
|
||||||
darwin/amd64 \
|
|
||||||
$(NULL)
|
|
||||||
|
|
||||||
# freebsd-386 \
|
|
||||||
# freebsd-arm \
|
|
||||||
# linux-arm \
|
|
||||||
# openbsd-386 \
|
|
||||||
# openbsd-amd64 \
|
|
||||||
# darwin-386
|
|
||||||
|
|
||||||
NAME=jira
|
NAME=jira
|
||||||
|
GO?=go
|
||||||
|
|
||||||
OS=$(shell uname -s)
|
OS=$(shell uname -s)
|
||||||
ifeq ($(filter CYGWIN%,$(OS)),$(OS))
|
ifeq ($(filter CYGWIN%,$(OS)),$(OS))
|
||||||
@@ -34,30 +19,31 @@ GOBIN ?= $(CWD)
|
|||||||
|
|
||||||
CURVER ?= $(patsubst v%,%,$(shell [ -d .git ] && git describe --abbrev=0 --tags || grep ^\#\# CHANGELOG.md | awk '{print $$2; exit}'))
|
CURVER ?= $(patsubst v%,%,$(shell [ -d .git ] && git describe --abbrev=0 --tags || grep ^\#\# CHANGELOG.md | awk '{print $$2; exit}'))
|
||||||
LDFLAGS:= -w
|
LDFLAGS:= -w
|
||||||
|
VERSION ?= development
|
||||||
|
|
||||||
build:
|
build:
|
||||||
go build -gcflags="-e" -v -ldflags "$(LDFLAGS) -s" -o '$(BIN)' cmd/jira/main.go
|
$(GO) build -gcflags="-e" -v -ldflags "$(LDFLAGS) -s" -o '$(BIN)' cmd/jira/main.go
|
||||||
|
|
||||||
vet:
|
vet:
|
||||||
@go vet .
|
@$(GO) vet .
|
||||||
@go vet ./jiracli
|
@$(GO) vet ./jiracli
|
||||||
@go vet ./jiracmd
|
@$(GO) vet ./jiracmd
|
||||||
@go vet ./jiradata
|
@$(GO) vet ./jiradata
|
||||||
@go vet ./cmd/jira
|
@$(GO) vet ./cmd/jira
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
@go get github.com/golang/lint/golint
|
@$(GO) get github.com/golang/lint/golint
|
||||||
@golint .
|
@golint .
|
||||||
@golint ./jiracli
|
@golint ./jiracli
|
||||||
@golint ./jiracmd
|
@golint ./jiracmd
|
||||||
@golint ./jiradata
|
@golint ./jiradata
|
||||||
@golint ./cmd/jira
|
@golint ./cmd/jira
|
||||||
|
|
||||||
all:
|
all:
|
||||||
docker pull karalabe/xgo-latest
|
GO111MODULE=off $(GO) get -u github.com/mitchellh/gox
|
||||||
rm -rf dist
|
rm -rf dist
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
docker run --rm -e EXT_GOPATH=/gopath -v $$(pwd):/gopath/src/gopkg.in/Netflix-Skunkworks/go-jira.v1 -e TARGETS="$(PLATFORMS)" -v $$(pwd)/dist:/build karalabe/xgo-latest gopkg.in/Netflix-Skunkworks/go-jira.v1/cmd/jira
|
gox -ldflags="-w -s" -ldflags="-X 'github.com/go-jira/jira.VERSION=$(VERSION)'" -output="dist/github.com/go-jira/jira-{{.OS}}-{{.Arch}}" -osarch="darwin/amd64 linux/386 linux/amd64 windows/386 windows/amd64" ./cmd/jira
|
||||||
|
|
||||||
install:
|
install:
|
||||||
${MAKE} GOBIN=$$HOME/bin build
|
${MAKE} GOBIN=$$HOME/bin build
|
||||||
@@ -66,7 +52,7 @@ NEWVER ?= $(shell echo $(CURVER) | awk -F. '{print $$1"."$$2"."$$3+1}')
|
|||||||
TODAY := $(shell date +%Y-%m-%d)
|
TODAY := $(shell date +%Y-%m-%d)
|
||||||
|
|
||||||
changes:
|
changes:
|
||||||
@git log --pretty=format:"* %s [%cn] [%h]" --no-merges ^v$(CURVER) HEAD *.go jiracli/*.go jiradata/*.go jiracmd/*.go cmd/*/*.go | grep -vE 'gofmt|go fmt'
|
@git log --pretty=format:"* %s [%cn] [%h]" --no-merges ^v$(CURVER) HEAD *.go jiracli/*.go jiradata/*.go jiracmd/*.go cmd/*/*.go *.lock | grep -vE 'gofmt|go fmt|version bump'
|
||||||
|
|
||||||
update-changelog:
|
update-changelog:
|
||||||
@echo "# Changelog" > CHANGELOG.md.new; \
|
@echo "# Changelog" > CHANGELOG.md.new; \
|
||||||
@@ -81,24 +67,34 @@ update-changelog:
|
|||||||
mv CHANGELOG.md.new CHANGELOG.md; \
|
mv CHANGELOG.md.new CHANGELOG.md; \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
update-usage:
|
||||||
|
@perl -pi -e 'undef $$/; s|\n```\nusage.*?```|"\n```\n".qx{./jira --help}."```"|esg' README.md
|
||||||
|
|
||||||
release:
|
release:
|
||||||
git commit -m "Updated Changelog" CHANGELOG.md; \
|
make update-usage
|
||||||
|
git diff --exit-code --quiet README.md || git commit -m "Updated Usage" README.md
|
||||||
|
git commit -m "Updated Changelog" CHANGELOG.md
|
||||||
|
git commit -m "version bump" jira.go
|
||||||
git tag v$(NEWVER)
|
git tag v$(NEWVER)
|
||||||
git push --tags
|
git push --tags
|
||||||
|
|
||||||
version:
|
version:
|
||||||
@echo $(CURVER)
|
@echo $(CURVER)
|
||||||
|
|
||||||
clean:
|
clean: clean-password-store
|
||||||
rm -rf ./$(NAME)
|
rm -rf ./$(NAME)
|
||||||
|
|
||||||
export GNUPGHOME=$(CWD)/t/.gnupg
|
clean-password-store:
|
||||||
export PASSWORD_STORE_DIR=$(CWD)/t/.password-store
|
rm -f "$(CWD)/_t/.password-store/GoJira/api-token:gojira@corybennett.org.gpg"
|
||||||
export JIRACLOUD=1
|
rm -f "$(CWD)/_t/.password-store/GoJira/api-token:mothra@corybennett.org.gpg"
|
||||||
|
|
||||||
prove:
|
test-password-store:
|
||||||
chmod -R g-rwx,o-rwx $(GNUPGHOME)
|
ln -s "api-token__gojira@corybennett.org.gpg" "$(CWD)/_t/.password-store/GoJira/api-token:gojira@corybennett.org.gpg"
|
||||||
OSHT_VERBOSE=1 prove -v
|
ln -s "api-token__mothra@corybennett.org.gpg" "$(CWD)/_t/.password-store/GoJira/api-token:mothra@corybennett.org.gpg"
|
||||||
|
|
||||||
|
prove: test-password-store
|
||||||
|
chmod -R g-rwx,o-rwx $(CWD)/_t/.gnupg
|
||||||
|
OSHT_VERBOSE=1 prove -v _t/*.t
|
||||||
|
|
||||||
generate:
|
generate:
|
||||||
cd schemas && ./fetch-schemas.py
|
cd schemas && ./fetch-schemas.py
|
||||||
|
|||||||
@@ -1,105 +1,57 @@
|
|||||||
[](https://gitter.im/go-jira-cli/help?utm_source=badge&utm_medium=badge&utm_content=badge)
|
[](https://travis-ci.org/go-jira/jira)
|
||||||
[](https://travis-ci.org/Netflix-Skunkworks/go-jira)
|
[](https://godoc.org/github.com/go-jira/jira)
|
||||||
[](https://godoc.org/gopkg.in/Netflix-Skunkworks/go-jira.v1)
|
[](https://opensource.org/licenses/Apache-2.0)
|
||||||
|
|
||||||
|
|
||||||
# go-jira
|
# go-jira
|
||||||
simple command line client for Atlassian's Jira service written in Go
|
|
||||||
|
Simple command line client for Atlassian's Jira service written in Go.
|
||||||
|
|
||||||
|
## GDPR USERNAME DISCLAIMER
|
||||||
|
|
||||||
|
When this tool was initial written the "username" parameter was widely used in the Atlassian API.
|
||||||
|
Due to GDPR restrictions this parameter was been almost completely phased out other then V1 login.
|
||||||
|
The "--user" field is still provided as a default global, however moving forward any usage of this field should be phased out in favor of the "--login" option.
|
||||||
|
|
||||||
|
Commands which previously took a username will now expect an email address such as watch, create, assign, etc...
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
### Download
|
### Download
|
||||||
|
|
||||||
You can download one of the pre-built binaries for **go-jira** [here](https://github.com/Netflix-Skunkworks/go-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 with [Go](https://golang.org/dl/):
|
You can build and install the official repository with [Go](https://golang.org/dl/) (before running the below command, ensure you have `GO111MODULE=on` set in your environment):
|
||||||
|
|
||||||
```
|
go get github.com/go-jira/jira/cmd/jira
|
||||||
go get gopkg.in/Netflix-Skunkworks/go-jira.v1/cmd/jira
|
|
||||||
```
|
|
||||||
|
|
||||||
## v1 vs v0 changes
|
This will checkout this repository into `$GOPATH/src/github.com/go-jira/jira/`, build, and install it.
|
||||||
|
|
||||||
###### **Golang library import**
|
It should then be available in $GOPATH/bin/jira.
|
||||||
For the new version of go-jira you should use:
|
|
||||||
```
|
|
||||||
import "gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
|
||||||
```
|
|
||||||
|
|
||||||
If you have code that depends on the old apis, you can still use them with this import:
|
## Usage
|
||||||
```
|
|
||||||
import "gopkg.in/Netflix-Skunkworks/go-jira.v0"
|
|
||||||
```
|
|
||||||
|
|
||||||
###### **Configs per command**
|
|
||||||
Instead of requiring a exectuable template to get configs for a given command now you can create a config to be applied to a command. So if you want to use `template: table` by default for yor `jira list` you can now do:
|
|
||||||
```
|
|
||||||
$ cat $HOME/.jira.d/list.yml
|
|
||||||
template: table
|
|
||||||
```
|
|
||||||
Where previously you needed something like:
|
|
||||||
```
|
|
||||||
# cat $HOME/.jira.d/config.yml
|
|
||||||
#!/bin/sh
|
|
||||||
case $JIRA_OPERATION in
|
|
||||||
list)
|
|
||||||
echo "template: table";;
|
|
||||||
esac
|
|
||||||
```
|
|
||||||
|
|
||||||
###### **Custom Commands**
|
#### Setting up TAB completion
|
||||||
Now you can create your own custom commands to do common operations with jira. Please see the details **Custom Commands** section below for more details. If you want to create a command `jira mine` that lists all the issues assigned to you now you can modify your `.jira.d/config.yml` file to add a `custom-commands` section like this:
|
|
||||||
```
|
|
||||||
custom-commands:
|
|
||||||
- name: mine
|
|
||||||
help: display issues assigned to me
|
|
||||||
script: |-
|
|
||||||
jira list --query "resolution = unresolved and assignee=currentuser() ORDER BY created"
|
|
||||||
```
|
|
||||||
Then the next time you run `jira help` you will see your usage:
|
|
||||||
```
|
|
||||||
$ jira mine --help
|
|
||||||
usage: jira mine
|
|
||||||
|
|
||||||
display issues assigned to me
|
Since go-jira is built with the "kingpin" golang command line library we support bash/zsh shell completion automatically:
|
||||||
|
|
||||||
Flags:
|
* <https://github.com/alecthomas/kingpin/tree/v2.2.5#bashzsh-shell-completion>
|
||||||
--help Show context-sensitive help (also try --help-long and --help-man).
|
|
||||||
-v, --verbose ... Increase verbosity for debugging
|
|
||||||
-e, --endpoint=ENDPOINT Base URI to use for Jira
|
|
||||||
-u, --user=USER Login name used for authentication with Jira service
|
|
||||||
--unixproxy=UNIXPROXY Path for a unix-socket proxy
|
|
||||||
-k, --insecure Disable TLS certificate verification
|
|
||||||
```
|
|
||||||
|
|
||||||
###### **Incompatible command changes**
|
For example, in bash, adding something along the lines of:
|
||||||
Unfortunately during the rewrite between v0 and v1 there were some changes necessary that broke backwards compatibility with existing commands. Specifically the `dups`, `blocks`, `add worklog` and `add|remove|set labels` commands have had the command word swapped around:
|
|
||||||
* `jira DUPLICATE dups ISSUE` => `jira dup DUPLICATE ISSUE`
|
|
||||||
* `jira BLOCKER blocks ISSUE` => `jira block BLOCKER ISSUE`
|
|
||||||
* `jira add worklog` => `jira worklog add`
|
|
||||||
* `jira add labels` => `jira labels add`
|
|
||||||
* `jira remove labels` => `jira labels remove`
|
|
||||||
* `jira set labels` => `jira labels set`
|
|
||||||
|
|
||||||
###### **Login process change**
|
`eval "$(jira --completion-script-bash)"`
|
||||||
Previously `jira` used attempt to get a `JSESSION` cookies by authenticating with the webservice standard GUI login process. This has been especially problematic as users need to authenticate with various credential providers (google auth, etc). We now attempt to authenticate via the [session login api](https://docs.atlassian.com/jira/REST/cloud/#auth/1/session-login). This may be problematic for users if admins have locked down the session-login api, so we might have to bring back the error-prone Basic-Auth approach. For users that are unable to authenticate via `jira` hopefully someone in your organization can provide me with details on a process for you to authenticate and we can try to update `jira`.
|
|
||||||
|
to your bashrc, or .profile (assuming go-jira binary is already in your path) will cause jira to offer tab completion behavior.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
**go-jira** uses a configuration hierarchy. When loading the configuration from disk it will recursively look through
|
**go-jira** uses a configuration hierarchy. When loading the configuration from disk it will recursively look through all parent directories in your current path looking for a **.jira.d** directory. If your current directory is not a child directory of your homedir, then your homedir will also be inspected for a **.jira.d** directory. From all of **.jira.d** directories discovered **go-jira** will load a **<command>.yml** file (ie for `jira list` it will load `.jira.d/list.yml`) then it will merge in any properties from the **config.yml** if found. The configuration properties found in a file closest to your current working directory will have precedence. Properties overridden with command line options will have final precedence.
|
||||||
all parent directories in your current path looking for a **.jira.d** directory. If your current directory is not
|
|
||||||
a child directory of your homedir, then your homedir will also be inspected for a **.jira.d** directory. From all of **.jira.d** directories
|
|
||||||
discovered **go-jira** will load a **<command>.yml** file (ie for `jira list` it will load `.jira.d/list.yml`) then it will merge in any properties from the **config.yml** if found. The configuration properties found in a file closests to your current working directory
|
|
||||||
will have precedence. Properties overriden with command line options will have final precedence.
|
|
||||||
|
|
||||||
The complicated configuration hierarchy is used because **go-jira** attempts to be context aware. For example, if you are working on a "foo" project and
|
The complicated configuration hierarchy is used because **go-jira** attempts to be context aware. For example, if you are working on a "foo" project and you `cd` into your project workspace, wouldn't it be nice if `jira ls` automatically knew to list only issues related to the "foo" project? Likewise when you `cd` to the "bar" project then `jira ls` should only list issues related to "bar" project. You can do this with by creating a configuration under your project workspace at **./.jira.d/config.yml** that looks like:
|
||||||
you `cd` into your project workspace, wouldn't it be nice if `jira ls` automatically knew to list only issues related to the "foo" project? Likewise when you
|
|
||||||
`cd` to the "bar" project then `jira ls` should only list issues related to "bar" project. You can do this with by creating a configuration under your project
|
|
||||||
workspace at **./.jira.d/config.yml** that looks like:
|
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
project: foo
|
project: foo
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -125,7 +77,7 @@ If the **.jira.d/config.yml** file is executable, then **go-jira** will attempt
|
|||||||
echo "endpoint: https://jira.mycompany.com"
|
echo "endpoint: https://jira.mycompany.com"
|
||||||
echo "editor: emacs -nw"
|
echo "editor: emacs -nw"
|
||||||
|
|
||||||
case $JIRA_OPERATION in
|
case $JIRA_OPERATION in
|
||||||
list)
|
list)
|
||||||
echo "template: table";;
|
echo "template: table";;
|
||||||
esac
|
esac
|
||||||
@@ -147,7 +99,7 @@ esac
|
|||||||
|
|
||||||
### Custom Commands
|
### Custom Commands
|
||||||
You can now create custom commands for `jira` just by editing your `.jira.d/config.yml` config file. These commands are effectively shell-scripts that can have documented options and arguments. The basic format is like:
|
You can now create custom commands for `jira` just by editing your `.jira.d/config.yml` config file. These commands are effectively shell-scripts that can have documented options and arguments. The basic format is like:
|
||||||
```
|
```yaml
|
||||||
custom-commands:
|
custom-commands:
|
||||||
- command1
|
- command1
|
||||||
- command2
|
- command2
|
||||||
@@ -160,14 +112,14 @@ Where the individual commands are maps with these keys:
|
|||||||
* `default: bool` Use this for compound command groups. If you wanted to have `jira foo bar` and `jira foo baz` you would have two commands with `name: foo bar` and `name: foo baz`. Then if you wanted `jira foo baz` to be called by default when you type `jira foo` you would set `default: true` for that custom command.
|
* `default: bool` Use this for compound command groups. If you wanted to have `jira foo bar` and `jira foo baz` you would have two commands with `name: foo bar` and `name: foo baz`. Then if you wanted `jira foo baz` to be called by default when you type `jira foo` you would set `default: true` for that custom command.
|
||||||
* `options: list` This is the list of possible option flags that the command will accept
|
* `options: list` This is the list of possible option flags that the command will accept
|
||||||
* `args: list` This is the list of command arguments (like the ISSUE) that the command will accept.
|
* `args: list` This is the list of command arguments (like the ISSUE) that the command will accept.
|
||||||
* `aliases: string list`: This is a list of alternate names that the user can provide on the command line to run the same command. Typically used to shorten the command name or provide alternatives that users might expect.
|
* `aliases: string list`: This is a list of alternate names that the user can provide on the command line to run the same command. Typically used to shorten the command name or provide alternatives that users might expect.
|
||||||
* `script: string` [**required**] This is the script that will be executed as the action for this command. The value will be treated as a template and substitutions for options and arguments will be made before executing.
|
* `script: string` [**required**] This is the script that will be executed as the action for this command. The value will be treated as a template and substitutions for options and arguments will be made before executing.
|
||||||
|
|
||||||
##### Options
|
##### Options
|
||||||
These are possible keys under the command `options` property:
|
These are possible keys under the command `options` property:
|
||||||
* `name: string` [**required**] Name of the option, so `name: foobar` will result in `--foobar` option.
|
* `name: string` [**required**] Name of the option, so `name: foobar` will result in `--foobar` option.
|
||||||
* `help: string` The help messsage displayed in usage for the option.
|
* `help: string` The help message displayed in usage for the option.
|
||||||
* `type: string`: The type of the option, can be one of these values: `BOOL`, `COUNTER`, `ENUM`, `FLOAT32`, `FLOAT64`, `INT8`, `INT16`, `INT32`, `INT64`, `INT`, `STRING`, `STRINGMAP`, `UINT8`, `UINT16`, `UINT32`, `UINT64` and `UINT`. Most of these are primitive data types an should be self-explanitory. The default type is `STRING`. There are some special types:
|
* `type: string`: The type of the option, can be one of these values: `BOOL`, `COUNTER`, `ENUM`, `FLOAT32`, `FLOAT64`, `INT8`, `INT16`, `INT32`, `INT64`, `INT`, `STRING`, `STRINGMAP`, `UINT8`, `UINT16`, `UINT32`, `UINT64` and `UINT`. Most of these are primitive data types an should be self-explanatory. The default type is `STRING`. There are some special types:
|
||||||
* `COUNTER` will be an integer type that increments each time the option is used. So something like `--count --count` will results in `{{options.count}}` of `2`.
|
* `COUNTER` will be an integer type that increments each time the option is used. So something like `--count --count` will results in `{{options.count}}` of `2`.
|
||||||
* `ENUM` type is used with the `enum` property. The raw type is a string and **must** be one of the values listed in the `enum` property.
|
* `ENUM` type is used with the `enum` property. The raw type is a string and **must** be one of the values listed in the `enum` property.
|
||||||
* `STRINGMAP` is a `string => string` map with the format of `KEY=VALUE`. So `--override foo=bar --override bin=baz` will allow for `{{options.override.foo}}` to be `bar` and `{{options.override.bin}}` to be `baz`.
|
* `STRINGMAP` is a `string => string` map with the format of `KEY=VALUE`. So `--override foo=bar --override bin=baz` will allow for `{{options.override.foo}}` to be `bar` and `{{options.override.bin}}` to be `baz`.
|
||||||
@@ -180,9 +132,9 @@ These are possible keys under the command `options` property:
|
|||||||
|
|
||||||
##### Arguments
|
##### Arguments
|
||||||
These are possible keys under the command `args` property:
|
These are possible keys under the command `args` property:
|
||||||
* `name: string` [**required**] Name of the option, so `name: ISSUE` will show in the usasge as `jira <command> ISSUE`. This also represents the name of the argument to be used in the script template, so `{{args.ISSUE}}`.
|
* `name: string` [**required**] Name of the option, so `name: ISSUE` will show in the usage as `jira <command> ISSUE`. This also represents the name of the argument to be used in the script template, so `{{args.ISSUE}}`.
|
||||||
* `help: string` The help messsage displayed in usage for the argument.
|
* `help: string` The help message displayed in usage for the argument.
|
||||||
* `type: string`: The type of the argumemnt, can be one of these values: `BOOL`, `COUNTER`, `ENUM`, `FLOAT32`, `FLOAT64`, `INT8`, `INT16`, `INT32`, `INT64`, `INT`, `STRING`, `STRINGMAP`, `UINT8`, `UINT16`, `UINT32`, `UINT64` and `UINT`. Most of these are primitive data types an should be self-explanitory. The default type is `STRING`. There are some special types:
|
* `type: string`: The type of the argument, can be one of these values: `BOOL`, `COUNTER`, `ENUM`, `FLOAT32`, `FLOAT64`, `INT8`, `INT16`, `INT32`, `INT64`, `INT`, `STRING`, `STRINGMAP`, `UINT8`, `UINT16`, `UINT32`, `UINT64` and `UINT`. Most of these are primitive data types an should be self-explanatory. The default type is `STRING`. There are some special types:
|
||||||
* `COUNTER` will be an integer type that increments each the argument is provided So something like `jira <command> ISSUE-12 ISSUE-23` will results in `{{args.ISSUE}}` of `2`.
|
* `COUNTER` will be an integer type that increments each the argument is provided So something like `jira <command> ISSUE-12 ISSUE-23` will results in `{{args.ISSUE}}` of `2`.
|
||||||
* `ENUM` type is used with the `enum` property. The raw type is a string and **must** be one of the values listed in the `enum` property.
|
* `ENUM` type is used with the `enum` property. The raw type is a string and **must** be one of the values listed in the `enum` property.
|
||||||
* `STRINGMAP` is a `string => string` map with the format of `KEY=VALUE`. So `jira <command> foo=bar bin=baz` along with a `name: OVERRIDE` property will allow for `{{args.OVERRIDE.foo}}` to be `bar` and `{{args.OVERRIDE.bin}}` to be `baz`.
|
* `STRINGMAP` is a `string => string` map with the format of `KEY=VALUE`. So `jira <command> foo=bar bin=baz` along with a `name: OVERRIDE` property will allow for `{{args.OVERRIDE.foo}}` to be `bar` and `{{args.OVERRIDE.bin}}` to be `baz`.
|
||||||
@@ -192,10 +144,10 @@ These are possible keys under the command `args` property:
|
|||||||
* `enum: string list` Used with the `type: ENUM` property, it is a list of strings values that represent the set of possible values for the argument.
|
* `enum: string list` Used with the `type: ENUM` property, it is a list of strings values that represent the set of possible values for the argument.
|
||||||
|
|
||||||
##### Script Template
|
##### Script Template
|
||||||
The `script` property is a template that whould produce `/bin/sh` compatible syntax after the template has been processed. There are 2 key template functions `{{args}}` and `{{options}}` that return the parsed arguments and option flags as a map.
|
The `script` property is a template that would produce `/bin/sh` compatible syntax after the template has been processed. There are 2 key template functions `{{args}}` and `{{options}}` that return the parsed arguments and option flags as a map.
|
||||||
|
|
||||||
To demonstrate how you might use args and options here is a `custom-test` command:
|
To demonstrate how you might use args and options here is a `custom-test` command:
|
||||||
```
|
```yaml
|
||||||
custom-commands:
|
custom-commands:
|
||||||
- name: custom-test
|
- name: custom-test
|
||||||
help: Testing the custom commands
|
help: Testing the custom commands
|
||||||
@@ -246,16 +198,16 @@ COMMAND arg1 --abc short-non-default --day Tuesday more1 more2 more3
|
|||||||
```
|
```
|
||||||
|
|
||||||
The script has access to all the environment variables that are in your current environment plus those that `jira` will set. `jira` sets environment variables for each config property it has parsed from `.jira.d/config.yml` or the command configs at `.jira.d/<command>.yml`. It might be useful to see all environment variables that `jira` is producing, so here is a simple custom command to list them:
|
The script has access to all the environment variables that are in your current environment plus those that `jira` will set. `jira` sets environment variables for each config property it has parsed from `.jira.d/config.yml` or the command configs at `.jira.d/<command>.yml`. It might be useful to see all environment variables that `jira` is producing, so here is a simple custom command to list them:
|
||||||
```
|
```yaml
|
||||||
custom-commands:
|
custom-commands:
|
||||||
- name: env
|
- name: env
|
||||||
help: print the JIRA environment variables available to custom commands
|
help: print the JIRA environment variables available to custom commands
|
||||||
script: |
|
script: |
|
||||||
env | grep JIRA
|
env | grep JIRA
|
||||||
```
|
```
|
||||||
|
|
||||||
You could use the environment variables automatically, so if your `.jira.d/config.yml` looks something like this:
|
You could use the environment variables automatically, so if your `.jira.d/config.yml` looks something like this:
|
||||||
```
|
```yaml
|
||||||
project: PROJECT
|
project: PROJECT
|
||||||
custom-commands:
|
custom-commands:
|
||||||
- name: print-project
|
- name: print-project
|
||||||
@@ -266,36 +218,38 @@ custom-commands:
|
|||||||
##### Examples
|
##### Examples
|
||||||
|
|
||||||
* `jira mine` for listing issues assigned to you
|
* `jira mine` for listing issues assigned to you
|
||||||
```
|
```yaml
|
||||||
|
custom-commands:
|
||||||
- name: mine
|
- name: mine
|
||||||
help: display issues assigned to me
|
help: display issues assigned to me
|
||||||
script: |-
|
script: |-
|
||||||
if [ -n "$JIRA_PROJECT" ]; then
|
if [ -n "$JIRA_PROJECT" ]; then
|
||||||
# if `project: ...` configured just list the issues for current project
|
# if `project: ...` configured just list the issues for current project
|
||||||
jira list --template table --query "resolution = unresolved and assignee=currentuser() and project = $JIRA_PROJECT ORDER BY priority asc, created"
|
{{jira}} list --template table --query "resolution = unresolved and assignee=currentuser() and project = $JIRA_PROJECT ORDER BY priority asc, created"
|
||||||
else
|
else
|
||||||
# otherwise list issues for all project
|
# otherwise list issues for all project
|
||||||
jira list --template table --query "resolution = unresolved and assignee=currentuser() ORDER BY priority asc, created"
|
{{jira}} list --template table --query "resolution = unresolved and assignee=currentuser() ORDER BY priority asc, created"
|
||||||
fi
|
fi
|
||||||
```
|
```
|
||||||
* `jira sprint` for listing issues in your current sprint
|
* `jira sprint` for listing issues in your current sprint
|
||||||
```
|
```yaml
|
||||||
|
custom-commands:
|
||||||
- name: sprint
|
- name: sprint
|
||||||
help: display issues for active sprint
|
help: display issues for active sprint
|
||||||
script: |-
|
script: |-
|
||||||
if [ -n "$JIRA_PROJECT" ]; then
|
if [ -n "$JIRA_PROJECT" ]; then
|
||||||
# if `project: ...` configured just list the issues for current project
|
# if `project: ...` configured just list the issues for current project
|
||||||
jira list --template table --query "sprint in openSprints() and type != epic and resolution = unresolved and project=$JIRA_PROJECT ORDER BY rank asc, created"
|
{{jira}} list --template table --query "sprint in openSprints() and type != epic and resolution = unresolved and project=$JIRA_PROJECT ORDER BY rank asc, created"
|
||||||
else
|
else
|
||||||
# otherwise list issues for all project
|
# otherwise list issues for all project
|
||||||
echo "\"project: ...\" configuration missing from .jira.d/config.yml"
|
{{jira}} list --template table --query "sprint in openSprints() and type != epic and resolution = unresolved ORDER BY rank asc, created"
|
||||||
fi
|
fi
|
||||||
```
|
```
|
||||||
|
|
||||||
### Editing
|
### Editing
|
||||||
|
|
||||||
When you run command like `jira edit` it will open up your favorite editor with the templatized output so you can quickly edit. When the editor
|
When you run command like `jira edit` it will open up your favorite editor with the templatized output so you can quickly edit. When the editor
|
||||||
closes **go-jira** will submit the completed form. The order which **go-jira** attempts to determine your prefered editor is:
|
closes **go-jira** will submit the completed form. The order which **go-jira** attempts to determine your preferred editor is:
|
||||||
|
|
||||||
* **editor** property in any config.yml file
|
* **editor** property in any config.yml file
|
||||||
* **JIRA_EDITOR** environment variable
|
* **JIRA_EDITOR** environment variable
|
||||||
@@ -314,9 +268,9 @@ 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 easlier to format the data, those functions are defined [here](https://github.com/Netflix-Skunkworks/go-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 eample 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:
|
||||||
```
|
```
|
||||||
jira view GOJIRA-321 -t debug
|
jira view GOJIRA-321 -t debug
|
||||||
```
|
```
|
||||||
@@ -328,9 +282,50 @@ jira list -t debug
|
|||||||
|
|
||||||
### Authentication
|
### Authentication
|
||||||
|
|
||||||
By default `go-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`.
|
#### Atlassian Cloud
|
||||||
|
|
||||||
#### keyring password source
|
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`.
|
||||||
|
|
||||||
|
##### Quickstart API Token and Keychain
|
||||||
|
|
||||||
|
1. Edit your config or execute the snippit (make sure to replace `<SUBDOMAIN>` and `<EMAIL>`)
|
||||||
|
```
|
||||||
|
export SUBDOMAIN="https://<SUBDOMAIN>.atlassian.net"
|
||||||
|
export EMAIL="<EMAIL>"
|
||||||
|
mkdir -p ~/.jira.d
|
||||||
|
printf "endpoint: $SUBDOMAIN\nuser: $EMAIL\npassword-source: keyring" > ~/.jira.d/config.yml
|
||||||
|
```
|
||||||
|
2. Create a new API Token at [id.atlassian.com](https://id.atlassian.com/manage-profile/security)
|
||||||
|
3. Execute `jira session` and enter your API Token. `jira` will add your session to the keyring.
|
||||||
|
|
||||||
|
#### Private Jira Service
|
||||||
|
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`.
|
||||||
|
|
||||||
|
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`.
|
||||||
|
|
||||||
|
Depending on how your private Jira service is configured, API tokens may require the "[Bearer][]" authentication scheme instead of the traditional "[Basic][]" [authentication scheme][scheme]. In this case, set the `authentication-method: bearer-token` property in your `$HOME/.jira.d/config.yml` file.
|
||||||
|
|
||||||
|
[scheme]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#authentication_schemes
|
||||||
|
[Bearer]: https://datatracker.ietf.org/doc/html/rfc6750
|
||||||
|
[Basic]: https://tools.ietf.org/html/rfc7617
|
||||||
|
|
||||||
|
| **API token [scheme][]** | `authentication-method` | **Example HTTP request header** |
|
||||||
|
|:------------------------:|-------------------------|-------------------------------------------------|
|
||||||
|
| [Basic][] | `api-token` | `Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQK` |
|
||||||
|
| [Bearer][] | `bearer-token` | `Authorization: Bearer MY_TOKEN` |
|
||||||
|
|
||||||
|
#### 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:
|
||||||
|
```yaml
|
||||||
|
user: person
|
||||||
|
login: person@example.com
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also override these values on the command line with `jira --user person --login person@example.com`. The `login` value will be used only for authentication purposes, the `user` value will be used when a user name is required for any Jira service API calls.
|
||||||
|
|
||||||
|
#### `keyring` password source
|
||||||
On OSX and Linux there are a few keyring providers that `go-jira` can use (via this [golang module](https://github.com/tmc/keyring)). To integrate `go-jira` with a supported keyring just add this configuration to `$HOME/.jira.d/config.yml`:
|
On OSX and Linux there are a few keyring providers that `go-jira` can use (via this [golang module](https://github.com/tmc/keyring)). To integrate `go-jira` with a supported keyring just add this configuration to `$HOME/.jira.d/config.yml`:
|
||||||
```yaml
|
```yaml
|
||||||
password-source: keyring
|
password-source: keyring
|
||||||
@@ -341,6 +336,7 @@ After setting this and issuing a `jira login`, your credentials will be stored i
|
|||||||
An alternative to the keyring password source is the `pass` tool (documentation [here](https://www.passwordstore.org/)). This uses gpg to encrypt/decrypt passwords on demand and by using `gpg-agent` you can cache the gpg credentials for a period of time so you will not be prompted repeatedly for decrypting the passwords. The advantage over the keyring integration is that `pass` can be used on more platforms than OSX and Linux, although it does require more setup. To use `pass` for password storage and retrieval via `go-jira` just add this configuration to `$HOME/.jira.d/config.yml`:
|
An alternative to the keyring password source is the `pass` tool (documentation [here](https://www.passwordstore.org/)). This uses gpg to encrypt/decrypt passwords on demand and by using `gpg-agent` you can cache the gpg credentials for a period of time so you will not be prompted repeatedly for decrypting the passwords. The advantage over the keyring integration is that `pass` can be used on more platforms than OSX and Linux, although it does require more setup. To use `pass` for password storage and retrieval via `go-jira` just add this configuration to `$HOME/.jira.d/config.yml`:
|
||||||
```yaml
|
```yaml
|
||||||
password-source: pass
|
password-source: pass
|
||||||
|
password-name: jira.example.com/myuser
|
||||||
```
|
```
|
||||||
|
|
||||||
This assumes you have already setup `pass` correctly on your system. Specifically you will need to have created a gpg key like this:
|
This assumes you have already setup `pass` correctly on your system. Specifically you will need to have created a gpg key like this:
|
||||||
@@ -364,7 +360,13 @@ Then initialize the `pass` tool to use the correct key:
|
|||||||
$ pass init "Go Jira <gojira@example.com>"
|
$ pass init "Go Jira <gojira@example.com>"
|
||||||
```
|
```
|
||||||
|
|
||||||
You probably want to setup gpg-agent so that you dont have to type in your gpg passphrase all the time. You can get `gpg-agent` to automatically start by adding something like this to your `$HOME/.bashrc`
|
Now insert your password with the name you configured.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ pass insert jira.example.com/myuser
|
||||||
|
```
|
||||||
|
|
||||||
|
You probably want to setup gpg-agent so that you don't have to type in your gpg passphrase all the time. You can get `gpg-agent` to automatically start by adding something like this to your `$HOME/.bashrc`
|
||||||
```bash
|
```bash
|
||||||
if [ -f $HOME/.gpg-agent-info ]; then
|
if [ -f $HOME/.gpg-agent-info ]; then
|
||||||
. $HOME/.gpg-agent-info
|
. $HOME/.gpg-agent-info
|
||||||
@@ -390,372 +392,37 @@ fi
|
|||||||
export GPG_TTY=$(tty)
|
export GPG_TTY=$(tty)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
#### `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
|
||||||
```
|
```
|
||||||
usage: jira [<flags>] <command> [<args> ...]
|
|
||||||
|
|
||||||
Jira Command Line Interface
|
For this to work, you need a working `gopass` installation.
|
||||||
|
|
||||||
Flags:
|
To configure your `gpg-agent` to cache your gpg passphrase take a look at the `pass` section of the readme.
|
||||||
--help Show context-sensitive help (also try --help-long and --help-man).
|
|
||||||
-v, --verbose ... Increase verbosity for debugging
|
|
||||||
-e, --endpoint=ENDPOINT Base URI to use for Jira
|
|
||||||
-k, --insecure Disable TLS certificate verification
|
|
||||||
-Q, --quiet Suppress output to console
|
|
||||||
--unixproxy=UNIXPROXY Path for a unix-socket proxy
|
|
||||||
-u, --user=USER Login name used for authentication with Jira service
|
|
||||||
|
|
||||||
Commands:
|
#### `stdin` password source
|
||||||
help [<command>...]
|
|
||||||
Show help.
|
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
version
|
```bash
|
||||||
Prints version
|
$ ./password-generator | jira login --endpoint=https://my.jira.endpoint.com --user=USERNAME
|
||||||
|
|
||||||
|
|
||||||
login
|
|
||||||
Attempt to login into jira server
|
|
||||||
|
|
||||||
|
|
||||||
logout
|
|
||||||
Deactivate sesssion with Jira server
|
|
||||||
|
|
||||||
|
|
||||||
list [<flags>]
|
|
||||||
Prints list of issues for given search criteria
|
|
||||||
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
-a, --assignee=ASSIGNEE User assigned the issue
|
|
||||||
-c, --component=COMPONENT Component to search for
|
|
||||||
-i, --issuetype=ISSUETYPE Issue type to search for
|
|
||||||
-l, --limit=LIMIT Maximum number of results to return in search
|
|
||||||
-p, --project=PROJECT Project to search for
|
|
||||||
-q, --query=QUERY Jira Query Language (JQL) expression for the search
|
|
||||||
-f, --queryfields=QUERYFIELDS Fields that are used in "list" template
|
|
||||||
-r, --reporter=REPORTER Reporter to search for
|
|
||||||
-s, --sort=SORT Sort order to return
|
|
||||||
-w, --watcher=WATCHER Watcher to search for
|
|
||||||
|
|
||||||
view [<flags>] <ISSUE>
|
|
||||||
Prints issue details
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
--expand=EXPAND ... field to expand for the issue
|
|
||||||
--field=FIELD ... field to return for the issue
|
|
||||||
--property=PROPERTY ... property to return for issue
|
|
||||||
|
|
||||||
create [<flags>]
|
|
||||||
Create issue
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
--editor=EDITOR Editor to use
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
--noedit Disable opening the editor
|
|
||||||
-p, --project=PROJECT project to create issue in
|
|
||||||
-i, --issuetype=ISSUETYPE issuetype in to create
|
|
||||||
-m, --comment=COMMENT Comment message for issue
|
|
||||||
-o, --override=OVERRIDE ... Set issue property
|
|
||||||
--saveFile=SAVEFILE Write issue as yaml to file
|
|
||||||
|
|
||||||
edit [<flags>] [<ISSUE>]
|
|
||||||
Edit issue details
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
--editor=EDITOR Editor to use
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
--noedit Disable opening the editor
|
|
||||||
-q, --query=QUERY Jira Query Language (JQL) expression for the search to edit multiple issues
|
|
||||||
-m, --comment=COMMENT Comment message for issue
|
|
||||||
-o, --override=OVERRIDE ... Set issue property
|
|
||||||
|
|
||||||
comment [<flags>] [<ISSUE>]
|
|
||||||
Add comment to issue
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
--editor=EDITOR Editor to use
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
--noedit Disable opening the editor
|
|
||||||
-m, --comment=COMMENT Comment message for issue
|
|
||||||
|
|
||||||
worklog list [<flags>] <ISSUE>
|
|
||||||
Prints the worklog data for given issue
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
|
|
||||||
worklog add [<flags>] <ISSUE>
|
|
||||||
Add a worklog to an issue
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
--editor=EDITOR Editor to use
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
--noedit Disable opening the editor
|
|
||||||
-m, --comment=COMMENT Comment message for worklog
|
|
||||||
-T, --time-spent=TIME-SPENT Time spent working on issue
|
|
||||||
|
|
||||||
fields [<flags>]
|
|
||||||
Prints all fields, both System and Custom
|
|
||||||
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
|
|
||||||
createmeta [<flags>]
|
|
||||||
View 'create' metadata
|
|
||||||
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
-p, --project=PROJECT project to fetch create metadata
|
|
||||||
-i, --issuetype=ISSUETYPE issuetype in project to fetch create metadata
|
|
||||||
|
|
||||||
editmeta [<flags>] <ISSUE>
|
|
||||||
View 'edit' metadata
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
|
|
||||||
subtask [<flags>] [<ISSUE>]
|
|
||||||
Subtask issue
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
--editor=EDITOR Editor to use
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
--noedit Disable opening the editor
|
|
||||||
-p, --project=PROJECT project to subtask issue in
|
|
||||||
-m, --comment=COMMENT Comment message for issue
|
|
||||||
-o, --override=OVERRIDE ... Set issue property
|
|
||||||
|
|
||||||
dup [<flags>] <DUPLICATE> <ISSUE>
|
|
||||||
Mark issues as duplicate
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
--editor=EDITOR Editor to use
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
-m, --comment=COMMENT Comment message when marking issue as duplicate
|
|
||||||
|
|
||||||
block [<flags>] <BLOCKER> <ISSUE>
|
|
||||||
Mark issues as blocker
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
--editor=EDITOR Editor to use
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
-m, --comment=COMMENT Comment message when marking issue as blocker
|
|
||||||
|
|
||||||
issuelink [<flags>] <OUTWARDISSUE> <ISSUELINKTYPE> <INWARDISSUE>
|
|
||||||
Link two issues
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
--editor=EDITOR Editor to use
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
-m, --comment=COMMENT Comment message when linking issue
|
|
||||||
|
|
||||||
issuelinktypes [<flags>]
|
|
||||||
Show the issue link types
|
|
||||||
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
|
|
||||||
transition [<flags>] <TRANSITION> <ISSUE>
|
|
||||||
Transition issue to given state
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
--noedit Disable opening the editor
|
|
||||||
-m, --comment=COMMENT Comment message for issue
|
|
||||||
-o, --override=OVERRIDE ... Set issue property
|
|
||||||
|
|
||||||
transitions [<flags>] <ISSUE>
|
|
||||||
List valid issue transitions
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
|
|
||||||
transmeta [<flags>] <ISSUE>
|
|
||||||
List valid issue transitions
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
|
|
||||||
close [<flags>] <ISSUE>
|
|
||||||
Transition issue to close state
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
--noedit Disable opening the editor
|
|
||||||
-m, --comment=COMMENT Comment message for issue
|
|
||||||
-o, --override=OVERRIDE ... Set issue property
|
|
||||||
|
|
||||||
acknowledge [<flags>] <ISSUE>
|
|
||||||
Transition issue to acknowledge state
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
--noedit Disable opening the editor
|
|
||||||
-m, --comment=COMMENT Comment message for issue
|
|
||||||
-o, --override=OVERRIDE ... Set issue property
|
|
||||||
|
|
||||||
reopen [<flags>] <ISSUE>
|
|
||||||
Transition issue to reopen state
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
--noedit Disable opening the editor
|
|
||||||
-m, --comment=COMMENT Comment message for issue
|
|
||||||
-o, --override=OVERRIDE ... Set issue property
|
|
||||||
|
|
||||||
resolve [<flags>] <ISSUE>
|
|
||||||
Transition issue to resolve state
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
--noedit Disable opening the editor
|
|
||||||
-m, --comment=COMMENT Comment message for issue
|
|
||||||
-o, --override=OVERRIDE ... Set issue property
|
|
||||||
|
|
||||||
start [<flags>] <ISSUE>
|
|
||||||
Transition issue to start state
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
--noedit Disable opening the editor
|
|
||||||
-m, --comment=COMMENT Comment message for issue
|
|
||||||
-o, --override=OVERRIDE ... Set issue property
|
|
||||||
|
|
||||||
stop [<flags>] <ISSUE>
|
|
||||||
Transition issue to stop state
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
--noedit Disable opening the editor
|
|
||||||
-m, --comment=COMMENT Comment message for issue
|
|
||||||
-o, --override=OVERRIDE ... Set issue property
|
|
||||||
|
|
||||||
todo [<flags>] <ISSUE>
|
|
||||||
Transition issue to To Do state
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
--noedit Disable opening the editor
|
|
||||||
-m, --comment=COMMENT Comment message for issue
|
|
||||||
-o, --override=OVERRIDE ... Set issue property
|
|
||||||
|
|
||||||
backlog [<flags>] <ISSUE>
|
|
||||||
Transition issue to Backlog state
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
--noedit Disable opening the editor
|
|
||||||
-m, --comment=COMMENT Comment message for issue
|
|
||||||
-o, --override=OVERRIDE ... Set issue property
|
|
||||||
|
|
||||||
done [<flags>] <ISSUE>
|
|
||||||
Transition issue to Done state
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
--noedit Disable opening the editor
|
|
||||||
-m, --comment=COMMENT Comment message for issue
|
|
||||||
-o, --override=OVERRIDE ... Set issue property
|
|
||||||
|
|
||||||
in-progress [<flags>] <ISSUE>
|
|
||||||
Transition issue to Progress state
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
--noedit Disable opening the editor
|
|
||||||
-m, --comment=COMMENT Comment message for issue
|
|
||||||
-o, --override=OVERRIDE ... Set issue property
|
|
||||||
|
|
||||||
vote [<flags>] [<ISSUE>]
|
|
||||||
Vote up/down an issue
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
-d, --down downvote the issue
|
|
||||||
|
|
||||||
rank [<flags>] <FIRST-ISSUE> <after|before> <SECOND-ISSUE>
|
|
||||||
Mark issues as blocker
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
|
|
||||||
watch [<flags>] <ISSUE> [<WATCHER>]
|
|
||||||
Add/Remove watcher to issue
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
-r, --remove remove watcher from issue
|
|
||||||
|
|
||||||
labels add [<flags>] <ISSUE> <LABEL>...
|
|
||||||
Add labels to an issue
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
|
|
||||||
labels set [<flags>] <ISSUE> <LABEL>...
|
|
||||||
Set labels on an issue
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
|
|
||||||
labels remove [<flags>] <ISSUE> <LABEL>...
|
|
||||||
Remove labels from an issue
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
|
|
||||||
take [<flags>] <ISSUE> [<ASSIGNEE>]
|
|
||||||
Assign issue to yourself
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
--default use default user for assignee
|
|
||||||
|
|
||||||
assign [<flags>] <ISSUE> [<ASSIGNEE>]
|
|
||||||
Assign user to issue
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
--default use default user for assignee
|
|
||||||
|
|
||||||
unassign [<flags>] <ISSUE> [<ASSIGNEE>]
|
|
||||||
Unassign an issue
|
|
||||||
|
|
||||||
-b, --browse Open issue(s) in browser after operation
|
|
||||||
--default use default user for assignee
|
|
||||||
|
|
||||||
component add [<flags>]
|
|
||||||
Add component
|
|
||||||
|
|
||||||
--editor=EDITOR Editor to use
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
--noedit Disable opening the editor
|
|
||||||
-p, --project=PROJECT project to create component in
|
|
||||||
-n, --name=NAME name of component
|
|
||||||
-d, --description=DESCRIPTION description of component
|
|
||||||
-l, --lead=LEAD person that acts as lead for component
|
|
||||||
|
|
||||||
components [<flags>]
|
|
||||||
Show components for a project
|
|
||||||
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
-p, --project=PROJECT project to list components
|
|
||||||
|
|
||||||
issuetypes [<flags>]
|
|
||||||
Show issue types for a project
|
|
||||||
|
|
||||||
-t, --template=TEMPLATE Template to use for output
|
|
||||||
-p, --project=PROJECT project to list issueTypes
|
|
||||||
|
|
||||||
export-templates [<flags>]
|
|
||||||
Export templates for customizations
|
|
||||||
|
|
||||||
-t, --template=TEMPLATE Template to export
|
|
||||||
-d, --dir=DIR directory to write tempates to
|
|
||||||
|
|
||||||
unexport-templates [<flags>]
|
|
||||||
Remove unmodified exported templates
|
|
||||||
|
|
||||||
-t, --template=TEMPLATE Template to export
|
|
||||||
-d, --dir=DIR directory to write tempates to
|
|
||||||
|
|
||||||
browse <ISSUE>
|
|
||||||
Open issue in browser
|
|
||||||
|
|
||||||
|
|
||||||
request [<flags>] <API> [<JSON>]
|
|
||||||
Open issue in requestr
|
|
||||||
|
|
||||||
-M, --method=METHOD HTTP request method to use
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### 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.
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
config:
|
||||||
|
stop: true
|
||||||
|
password-source: pass
|
||||||
|
endpoint: https://go-jira.atlassian.net
|
||||||
|
user: gojira
|
||||||
|
login: gojira@corybennett.org
|
||||||
|
|
||||||
|
project: BASIC
|
||||||
|
|
||||||
|
queries:
|
||||||
|
todo: >-
|
||||||
|
resolution = unresolved {{if .project}}AND project = '{{.project}}'{{end}} AND status = 'To Do'
|
||||||
|
|
||||||
|
custom-commands:
|
||||||
|
- name: env
|
||||||
|
help: print the JIRA environment variables available to custom commands
|
||||||
|
script: |-
|
||||||
|
env | sort | grep JIRA
|
||||||
|
- name: print-project
|
||||||
|
help: print the name of the configured project
|
||||||
|
script: "echo $JIRA_PROJECT"
|
||||||
|
- name: jira-path
|
||||||
|
help: print the path the jira command that is running this alias
|
||||||
|
script: |-
|
||||||
|
echo {{jira}}
|
||||||
|
- name: mine
|
||||||
|
help: display issues assigned to me
|
||||||
|
script: |-
|
||||||
|
if [ -n "$JIRA_PROJECT" ]; then
|
||||||
|
# if `project: ...` configured just list the issues for current project
|
||||||
|
{{jira}} list --template table --query "resolution = unresolved and assignee=currentuser() and project = $JIRA_PROJECT ORDER BY priority asc, created"
|
||||||
|
else
|
||||||
|
# otherwise list issues for all project
|
||||||
|
{{jira}} list --template table --query "resolution = unresolved and assignee=currentuser() ORDER BY priority asc, created"
|
||||||
|
fi
|
||||||
|
- name: argtest
|
||||||
|
help: testing passing args
|
||||||
|
script: |-
|
||||||
|
echo {{args.ARG}}
|
||||||
|
args:
|
||||||
|
- name: ARG
|
||||||
|
help: string to echo for testing
|
||||||
|
- name: opttest
|
||||||
|
help: testing passing option flags
|
||||||
|
script: |-
|
||||||
|
echo {{options.OPT}}
|
||||||
|
options:
|
||||||
|
- name: OPT
|
||||||
|
help: string to echo for testing
|
||||||
Binary file not shown.
Binary file not shown.
@@ -3,6 +3,8 @@ eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)"
|
|||||||
cd $(dirname $0)
|
cd $(dirname $0)
|
||||||
jira="../jira --user admin"
|
jira="../jira --user admin"
|
||||||
|
|
||||||
|
. env.sh
|
||||||
|
|
||||||
SKIP test -n "$JIRACLOUD" # using Jira Cloud at go-jira.atlassian.net
|
SKIP test -n "$JIRACLOUD" # using Jira Cloud at go-jira.atlassian.net
|
||||||
PLAN 15
|
PLAN 15
|
||||||
|
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)"
|
eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)"
|
||||||
cd $(dirname $0)
|
cd $(dirname $0)
|
||||||
jira=../jira
|
jira=../jira
|
||||||
|
. env.sh
|
||||||
|
|
||||||
SKIP test -n "$JIRACLOUD" # using Jira Cloud at go-jira.atlassian.net
|
SKIP test -n "$JIRACLOUD" # using Jira Cloud at go-jira.atlassian.net
|
||||||
|
|
||||||
@@ -2,15 +2,9 @@
|
|||||||
eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)"
|
eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)"
|
||||||
cd $(dirname $0)
|
cd $(dirname $0)
|
||||||
jira="../jira"
|
jira="../jira"
|
||||||
export JIRA_LOG_FORMAT="%{level:-5s} %{message}"
|
. env.sh
|
||||||
|
|
||||||
export COLUMNS=149
|
PLAN 98
|
||||||
ENDPOINT="http://localhost:8080"
|
|
||||||
if [ -n "$JIRACLOUD" ]; then
|
|
||||||
ENDPOINT="https://go-jira.atlassian.net"
|
|
||||||
fi
|
|
||||||
|
|
||||||
PLAN 86
|
|
||||||
|
|
||||||
# reset login
|
# reset login
|
||||||
RUNS $jira logout
|
RUNS $jira logout
|
||||||
@@ -41,8 +35,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: BASIC
|
project: BASIC
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
priority: Medium
|
priority: Medium
|
||||||
votes: 0
|
votes: 0
|
||||||
description: |
|
description: |
|
||||||
@@ -58,17 +52,64 @@ DIFF <<EOF
|
|||||||
$(printf %-12s $issue:) summary
|
$(printf %-12s $issue:) summary
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## List issues using a named query
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira ls --project BASIC -n todo
|
||||||
|
DIFF <<EOF
|
||||||
|
$(printf %-12s $issue:) summary
|
||||||
|
EOF
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
## List all issues, using the table template
|
## List all issues, using the table template
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
RUNS $jira ls --project BASIC --template table
|
RUNS $jira ls --project BASIC --template table
|
||||||
DIFF <<EOF
|
DIFF <<EOF
|
||||||
+----------------+---------------------------------------------------------+--------------+--------------+------------+--------------+--------------+
|
+------------+---------+------+----------+--------+----------+----------+----------+
|
||||||
| Issue | Summary | Priority | Status | Age | Reporter | Assignee |
|
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
|
||||||
+----------------+---------------------------------------------------------+--------------+--------------+------------+--------------+--------------+
|
+------------+---------+------+----------+--------+----------+----------+----------+
|
||||||
| $(printf %-14s $issue) | summary | Medium | To Do | a minute | gojira | gojira |
|
| $issue | summary | Bug | Medium | To Do | a minute | GoJira | GoJira |
|
||||||
+----------------+---------------------------------------------------------+--------------+--------------+------------+--------------+--------------+
|
+------------+---------+------+----------+--------+----------+----------+----------+
|
||||||
|
EOF
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Edit an issue
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira edit $issue -m "edit comment" --override priority=High --noedit
|
||||||
|
DIFF <<EOF
|
||||||
|
OK $issue $ENDPOINT/browse/$issue
|
||||||
|
EOF
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Edit multiple issues with query
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira edit -m "bulk edit comment" --override priority=High --noedit --query "resolution = unresolved AND project = 'BASIC' AND status = 'To Do'"
|
||||||
|
DIFF <<EOF
|
||||||
|
OK $issue $ENDPOINT/browse/$issue
|
||||||
|
EOF
|
||||||
|
|
||||||
|
RUNS $jira $issue
|
||||||
|
DIFF <<EOF
|
||||||
|
issue: $issue
|
||||||
|
created: a minute ago
|
||||||
|
status: To Do
|
||||||
|
summary: summary
|
||||||
|
project: BASIC
|
||||||
|
issuetype: Bug
|
||||||
|
assignee: GoJira
|
||||||
|
reporter: GoJira
|
||||||
|
priority: High
|
||||||
|
votes: 0
|
||||||
|
description: |
|
||||||
|
description
|
||||||
|
|
||||||
|
comments:
|
||||||
|
- | # GoJira, a minute ago
|
||||||
|
edit comment
|
||||||
|
- | # GoJira, a minute ago
|
||||||
|
bulk edit comment
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -133,8 +174,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: BASIC
|
project: BASIC
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -180,8 +221,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: BASIC
|
project: BASIC
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[To Do]
|
blockers: $blocker[To Do]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -204,7 +245,7 @@ EOF
|
|||||||
# reset login for mothra for voting
|
# reset login for mothra for voting
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
jira="$jira --user mothra"
|
jira="$jira --user mothra --login mothra@corybennett.org"
|
||||||
|
|
||||||
RUNS $jira logout
|
RUNS $jira logout
|
||||||
RUNS $jira login
|
RUNS $jira login
|
||||||
@@ -226,8 +267,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: BASIC
|
project: BASIC
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[To Do]
|
blockers: $blocker[To Do]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -253,8 +294,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: BASIC
|
project: BASIC
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[To Do]
|
blockers: $blocker[To Do]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -273,10 +314,10 @@ OK $issue $ENDPOINT/browse/$issue
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
# FIXME we probably need a watchers command to wrap this?
|
# FIXME we probably need a watchers command to wrap this?
|
||||||
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].name | sort"
|
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].displayName | sort"
|
||||||
DIFF <<EOF
|
DIFF <<EOF
|
||||||
gojira
|
GoJira
|
||||||
mothra
|
Mothra
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -345,8 +386,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: BASIC
|
project: BASIC
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[Done]
|
blockers: $blocker[Done]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -372,8 +413,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: BASIC
|
project: BASIC
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[Done]
|
blockers: $blocker[Done]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -382,7 +423,7 @@ description: |
|
|||||||
description
|
description
|
||||||
|
|
||||||
comments:
|
comments:
|
||||||
- | # mothra, a minute ago
|
- | # Mothra, a minute ago
|
||||||
Yo, Comment
|
Yo, Comment
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
@@ -404,8 +445,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: BASIC
|
project: BASIC
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[To Do]
|
depends: $issue[To Do]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -432,8 +473,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: BASIC
|
project: BASIC
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[To Do]
|
depends: $issue[To Do]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -460,8 +501,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: BASIC
|
project: BASIC
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[To Do]
|
depends: $issue[To Do]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -488,8 +529,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: BASIC
|
project: BASIC
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: mothra
|
assignee: Mothra
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[To Do]
|
depends: $issue[To Do]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -516,8 +557,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: BASIC
|
project: BASIC
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[To Do]
|
depends: $issue[To Do]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -526,3 +567,15 @@ labels: better-label, more-label
|
|||||||
description: |
|
description: |
|
||||||
blocks
|
blocks
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## List 102 closed issues, should be more than 100 (max page size), verify pagination
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira ls -q "project = 'BASIC' AND status = 'Done'" --limit 102
|
||||||
|
IS $(wc -l <$OSHT_STDOUT) -eq 102
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## List 1 issue, verify we dont get full page
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira ls -q "project = 'BASIC' AND status = 'Done'" --limit 1
|
||||||
|
IS $(wc -l <$OSHT_STDOUT) -eq 1
|
||||||
Executable
+48
@@ -0,0 +1,48 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
@@ -2,12 +2,7 @@
|
|||||||
eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)"
|
eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)"
|
||||||
cd $(dirname $0)
|
cd $(dirname $0)
|
||||||
jira="../jira"
|
jira="../jira"
|
||||||
export JIRA_LOG_FORMAT="%{level:-5s} %{message}"
|
. env.sh
|
||||||
|
|
||||||
ENDPOINT="http://localhost:8080"
|
|
||||||
if [ -n "$JIRACLOUD" ]; then
|
|
||||||
ENDPOINT="https://go-jira.atlassian.net"
|
|
||||||
fi
|
|
||||||
|
|
||||||
PLAN 8
|
PLAN 8
|
||||||
|
|
||||||
@@ -31,7 +26,7 @@ EOF
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
## Add a worklog to an issue
|
## Add a worklog to an issue
|
||||||
###############################################################################
|
###############################################################################
|
||||||
RUNS $jira worklog add $issue --comment "work is hard" --time-spent "1h 12m" --noedit
|
RUNS $jira worklog add $issue --comment "work is hard" --time-spent "1h 12m" -S "2017-01-29T09:17:00.000-0500" --noedit
|
||||||
DIFF <<EOF
|
DIFF <<EOF
|
||||||
OK $issue $ENDPOINT/browse/$issue
|
OK $issue $ENDPOINT/browse/$issue
|
||||||
EOF
|
EOF
|
||||||
@@ -41,8 +36,9 @@ EOF
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
RUNS $jira worklog $issue
|
RUNS $jira worklog $issue
|
||||||
DIFF <<EOF
|
DIFF <<EOF
|
||||||
- # gojira, a minute ago
|
- # GoJira, a minute ago
|
||||||
comment: work is hard
|
comment: work is hard
|
||||||
|
started: 2017-01-29T06:17:00.000-0800
|
||||||
timeSpent: 1h 12m
|
timeSpent: 1h 12m
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
Executable
+80
@@ -0,0 +1,80 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)"
|
||||||
|
cd $(dirname $0)
|
||||||
|
jira="../jira"
|
||||||
|
. env.sh
|
||||||
|
|
||||||
|
PLAN 16
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Testing the example custom commands, print-project
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
RUNS $jira print-project
|
||||||
|
DIFF <<EOF
|
||||||
|
BASIC
|
||||||
|
EOF
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Testing the example custom commands, jira-path
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
RUNS $jira jira-path
|
||||||
|
DIFF <<EOF
|
||||||
|
../jira
|
||||||
|
EOF
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Testing the example custom commands, env
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
RUNS $jira env
|
||||||
|
GREP ^JIRA_PROJECT=BASIC
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Testing the example custom commands, argtest
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
RUNS $jira argtest TEST
|
||||||
|
DIFF <<EOF
|
||||||
|
TEST
|
||||||
|
EOF
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Testing the example custom commands, opttest
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
RUNS $jira opttest --OPT TEST
|
||||||
|
DIFF <<EOF
|
||||||
|
TEST
|
||||||
|
EOF
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Use the "mine" alias to list issues assigned to self
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
RUNS $jira mine
|
||||||
|
DIFF <<EOF
|
||||||
|
+------------+---------+------+----------+--------+----------+----------+----------+
|
||||||
|
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
|
||||||
|
+------------+---------+------+----------+--------+----------+----------+----------+
|
||||||
|
| $issue | summary | Bug | Medium | To Do | a minute | GoJira | GoJira |
|
||||||
|
+------------+---------+------+----------+--------+----------+----------+----------+
|
||||||
|
EOF
|
||||||
Executable
+121
@@ -0,0 +1,121 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)"
|
||||||
|
cd $(dirname $0)
|
||||||
|
jira="../jira"
|
||||||
|
. env.sh
|
||||||
|
|
||||||
|
PLAN 22
|
||||||
|
|
||||||
|
# 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 epic
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira epic create --project BASIC -o summary="Totally Epic" -o description=description --epic-name "Basic Epic" --noedit --saveFile issue.props
|
||||||
|
epic=$(awk '/issue/{print $2}' issue.props)
|
||||||
|
|
||||||
|
DIFF <<EOF
|
||||||
|
OK $epic $ENDPOINT/browse/$epic
|
||||||
|
EOF
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Create issues we can assign to epic
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira create --project BASIC -o summary="summary" -o description=description --noedit --saveFile issue.props
|
||||||
|
issue1=$(awk '/issue/{print $2}' issue.props)
|
||||||
|
|
||||||
|
DIFF <<EOF
|
||||||
|
OK $issue1 $ENDPOINT/browse/$issue1
|
||||||
|
EOF
|
||||||
|
|
||||||
|
RUNS $jira create --project BASIC -o summary="summary" -o description=description --noedit --saveFile issue.props
|
||||||
|
issue2=$(awk '/issue/{print $2}' issue.props)
|
||||||
|
|
||||||
|
DIFF <<EOF
|
||||||
|
OK $issue2 $ENDPOINT/browse/$issue2
|
||||||
|
EOF
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## List the issues for the epic
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira epic list $epic
|
||||||
|
|
||||||
|
DIFF<<EOF
|
||||||
|
+-------+---------+------+----------+--------+-----+----------+----------+
|
||||||
|
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
|
||||||
|
+-------+---------+------+----------+--------+-----+----------+----------+
|
||||||
|
+-------+---------+------+----------+--------+-----+----------+----------+
|
||||||
|
EOF
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Add issues to an epic
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira epic add $epic $issue1 $issue2
|
||||||
|
|
||||||
|
DIFF<<EOF
|
||||||
|
OK $epic $ENDPOINT/browse/$epic
|
||||||
|
OK $issue1 $ENDPOINT/browse/$issue1
|
||||||
|
OK $issue2 $ENDPOINT/browse/$issue2
|
||||||
|
EOF
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## List the issues for the epic
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira epic list $epic
|
||||||
|
|
||||||
|
DIFF<<EOF
|
||||||
|
+------------+---------+------+----------+--------+----------+----------+----------+
|
||||||
|
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
|
||||||
|
+------------+---------+------+----------+--------+----------+----------+----------+
|
||||||
|
| $issue1 | summary | Bug | Medium | To Do | a minute | GoJira | GoJira |
|
||||||
|
| $issue2 | summary | Bug | Medium | To Do | a minute | GoJira | GoJira |
|
||||||
|
+------------+---------+------+----------+--------+----------+----------+----------+
|
||||||
|
EOF
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Remove an issue from an Epic
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira epic remove $issue1
|
||||||
|
|
||||||
|
DIFF<<EOF
|
||||||
|
OK $issue1 $ENDPOINT/browse/$issue1
|
||||||
|
EOF
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## List the issues for the epic
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira epic list $epic
|
||||||
|
|
||||||
|
DIFF<<EOF
|
||||||
|
+------------+---------+------+----------+--------+----------+----------+----------+
|
||||||
|
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
|
||||||
|
+------------+---------+------+----------+--------+----------+----------+----------+
|
||||||
|
| $issue2 | summary | Bug | Medium | To Do | a minute | GoJira | GoJira |
|
||||||
|
+------------+---------+------+----------+--------+----------+----------+----------+
|
||||||
|
EOF
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Remove last issue from an Epic
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira epic remove $issue2
|
||||||
|
|
||||||
|
DIFF<<EOF
|
||||||
|
OK $issue2 $ENDPOINT/browse/$issue2
|
||||||
|
EOF
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## List the issues for the epic
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira epic list $epic
|
||||||
|
|
||||||
|
DIFF<<EOF
|
||||||
|
+-------+---------+------+----------+--------+-----+----------+----------+
|
||||||
|
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
|
||||||
|
+-------+---------+------+----------+--------+-----+----------+----------+
|
||||||
|
+-------+---------+------+----------+--------+-----+----------+----------+
|
||||||
|
EOF
|
||||||
Executable
+189
@@ -0,0 +1,189 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)"
|
||||||
|
cd $(dirname $0)
|
||||||
|
jira="../jira"
|
||||||
|
. env.sh
|
||||||
|
|
||||||
|
PLAN 43
|
||||||
|
|
||||||
|
# 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="Attach To Me" -o description=description --noedit --saveFile issue.props
|
||||||
|
issue=$(awk '/issue/{print $2}' issue.props)
|
||||||
|
|
||||||
|
DIFF <<EOF
|
||||||
|
OK $issue $ENDPOINT/browse/$issue
|
||||||
|
EOF
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Attach via stdin
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira attach create $issue --filename README.md --saveFile attach.props < ./README.md
|
||||||
|
attach1=$(awk '/^id:/{print $2}' attach.props)
|
||||||
|
|
||||||
|
DIFF <<EOF
|
||||||
|
OK $attach1 $ENDPOINT/secure/attachment/$attach1/README.md
|
||||||
|
EOF
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Attach binary file
|
||||||
|
###############################################################################
|
||||||
|
RUNS dd of=garbage.bin if=/dev/urandom count=1k bs=1k
|
||||||
|
RUNS $jira attach create $issue garbage.bin --saveFile attach.props
|
||||||
|
attach2=$(awk '/^id:/{print $2}' attach.props)
|
||||||
|
|
||||||
|
DIFF <<EOF
|
||||||
|
OK $attach2 $ENDPOINT/secure/attachment/$attach2/garbage.bin
|
||||||
|
EOF
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Attach binary file with different name
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira attach create $issue garbage.bin --filename foobar.bin --saveFile attach.props
|
||||||
|
attach3=$(awk '/^id:/{print $2}' attach.props)
|
||||||
|
|
||||||
|
DIFF <<EOF
|
||||||
|
OK $attach3 $ENDPOINT/secure/attachment/$attach3/foobar.bin
|
||||||
|
EOF
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## List attachments
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira attach list $issue
|
||||||
|
DIFF <<EOF
|
||||||
|
+-------+-------------+---------+--------+----------+
|
||||||
|
| id | filename | bytes | user | created |
|
||||||
|
+-------+-------------+---------+--------+----------+
|
||||||
|
| $attach1 | README.md | 1239 | GoJira | a minute |
|
||||||
|
| $attach2 | garbage.bin | 1048576 | GoJira | a minute |
|
||||||
|
| $attach3 | foobar.bin | 1048576 | GoJira | a minute |
|
||||||
|
+-------+-------------+---------+--------+----------+
|
||||||
|
EOF
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Fetch text attachment
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira attach get $attach1 -o attach1.txt
|
||||||
|
DIFF <<EOF
|
||||||
|
OK Wrote attach1.txt
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# verify no diffs
|
||||||
|
RUNS diff -q README.md attach1.txt
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Fetch text attachment to stdout
|
||||||
|
###############################################################################
|
||||||
|
RUNS sh -c "$jira attach get $attach1 -o- > attach1.txt"
|
||||||
|
|
||||||
|
# verify no diffs
|
||||||
|
RUNS diff -q README.md attach1.txt
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Fetch text attachment as same name
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira attach get $attach1
|
||||||
|
DIFF <<EOF
|
||||||
|
OK Wrote README.md
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# verify no diffs
|
||||||
|
RUNS git diff README.md
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Fetch binary attachment
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira attach get $attach2 --output binary.out
|
||||||
|
DIFF <<EOF
|
||||||
|
OK Wrote binary.out
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# verify no diffs
|
||||||
|
RUNS diff -q garbage.bin binary.out
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Fetch binary attachment to stdout
|
||||||
|
###############################################################################
|
||||||
|
RUNS sh -c "$jira attach get $attach2 -o- > binary.out"
|
||||||
|
|
||||||
|
# verify no diffs
|
||||||
|
RUNS diff -q garbage.bin binary.out
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Fetch binary attachment
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira attach get $attach3
|
||||||
|
DIFF <<EOF
|
||||||
|
OK Wrote foobar.bin
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# verify no diffs
|
||||||
|
RUNS diff -q garbage.bin foobar.bin
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Fetch binary attachment to stdout
|
||||||
|
###############################################################################
|
||||||
|
RUNS sh -c "$jira attach get $attach3 --output=- > binary.out"
|
||||||
|
|
||||||
|
# verify no diffs
|
||||||
|
RUNS diff -q garbage.bin binary.out
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Delete attachment
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira attach remove $attach1
|
||||||
|
DIFF <<EOF
|
||||||
|
OK Deleted Attachment $attach1
|
||||||
|
EOF
|
||||||
|
|
||||||
|
RUNS $jira attach list $issue
|
||||||
|
DIFF <<EOF
|
||||||
|
+-------+-------------+---------+--------+----------+
|
||||||
|
| id | filename | bytes | user | created |
|
||||||
|
+-------+-------------+---------+--------+----------+
|
||||||
|
| $attach2 | garbage.bin | 1048576 | GoJira | a minute |
|
||||||
|
| $attach3 | foobar.bin | 1048576 | GoJira | a minute |
|
||||||
|
+-------+-------------+---------+--------+----------+
|
||||||
|
EOF
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Delete attachment
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira attach rm $attach2
|
||||||
|
DIFF <<EOF
|
||||||
|
OK Deleted Attachment $attach2
|
||||||
|
EOF
|
||||||
|
|
||||||
|
RUNS $jira attach list $issue
|
||||||
|
DIFF <<EOF
|
||||||
|
+-------+------------+---------+--------+----------+
|
||||||
|
| id | filename | bytes | user | created |
|
||||||
|
+-------+------------+---------+--------+----------+
|
||||||
|
| $attach3 | foobar.bin | 1048576 | GoJira | a minute |
|
||||||
|
+-------+------------+---------+--------+----------+
|
||||||
|
EOF
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
## Delete last
|
||||||
|
###############################################################################
|
||||||
|
RUNS $jira attach rm $attach3
|
||||||
|
DIFF <<EOF
|
||||||
|
OK Deleted Attachment $attach3
|
||||||
|
EOF
|
||||||
|
|
||||||
|
RUNS $jira attach list $issue
|
||||||
|
DIFF <<EOF
|
||||||
|
+----+----------+-------+------+---------+
|
||||||
|
| id | filename | bytes | user | created |
|
||||||
|
+----+----------+-------+------+---------+
|
||||||
|
+----+----------+-------+------+---------+
|
||||||
|
EOF
|
||||||
@@ -2,12 +2,7 @@
|
|||||||
eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)"
|
eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)"
|
||||||
cd $(dirname $0)
|
cd $(dirname $0)
|
||||||
jira="../jira"
|
jira="../jira"
|
||||||
export JIRA_LOG_FORMAT="%{level:-5s} %{message}"
|
. env.sh
|
||||||
|
|
||||||
ENDPOINT="http://localhost:8080"
|
|
||||||
if [ -n "$JIRACLOUD" ]; then
|
|
||||||
ENDPOINT="https://go-jira.atlassian.net"
|
|
||||||
fi
|
|
||||||
|
|
||||||
PLAN 84
|
PLAN 84
|
||||||
|
|
||||||
@@ -40,8 +35,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: SCRUM
|
project: SCRUM
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
priority: Medium
|
priority: Medium
|
||||||
votes: 0
|
votes: 0
|
||||||
description: |
|
description: |
|
||||||
@@ -119,8 +114,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: SCRUM
|
project: SCRUM
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -166,8 +161,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: SCRUM
|
project: SCRUM
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[To Do]
|
blockers: $blocker[To Do]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -190,7 +185,7 @@ EOF
|
|||||||
# reset login for mothra for voting
|
# reset login for mothra for voting
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
jira="$jira --user mothra"
|
jira="$jira --user mothra --login mothra@corybennett.org"
|
||||||
|
|
||||||
RUNS $jira logout
|
RUNS $jira logout
|
||||||
echo "mothra123" | RUNS $jira login
|
echo "mothra123" | RUNS $jira login
|
||||||
@@ -212,8 +207,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: SCRUM
|
project: SCRUM
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[To Do]
|
blockers: $blocker[To Do]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -239,8 +234,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: SCRUM
|
project: SCRUM
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[To Do]
|
blockers: $blocker[To Do]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -259,10 +254,10 @@ OK $issue $ENDPOINT/browse/$issue
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
# FIXME we probably need a watchers command to wrap this?
|
# FIXME we probably need a watchers command to wrap this?
|
||||||
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].name | sort"
|
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].displayName | sort"
|
||||||
DIFF <<EOF
|
DIFF <<EOF
|
||||||
gojira
|
GoJira
|
||||||
mothra
|
Mothra
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -331,8 +326,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: SCRUM
|
project: SCRUM
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[Done]
|
blockers: $blocker[Done]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -358,8 +353,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: SCRUM
|
project: SCRUM
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[Done]
|
blockers: $blocker[Done]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -368,7 +363,7 @@ description: |
|
|||||||
description
|
description
|
||||||
|
|
||||||
comments:
|
comments:
|
||||||
- | # mothra, a minute ago
|
- | # Mothra, a minute ago
|
||||||
Yo, Comment
|
Yo, Comment
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
@@ -390,8 +385,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: SCRUM
|
project: SCRUM
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[To Do]
|
depends: $issue[To Do]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -418,8 +413,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: SCRUM
|
project: SCRUM
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[To Do]
|
depends: $issue[To Do]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -446,8 +441,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: SCRUM
|
project: SCRUM
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[To Do]
|
depends: $issue[To Do]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -474,8 +469,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: SCRUM
|
project: SCRUM
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: mothra
|
assignee: Mothra
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[To Do]
|
depends: $issue[To Do]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -502,8 +497,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: SCRUM
|
project: SCRUM
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[To Do]
|
depends: $issue[To Do]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -2,12 +2,7 @@
|
|||||||
eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)"
|
eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)"
|
||||||
cd $(dirname $0)
|
cd $(dirname $0)
|
||||||
jira="../jira"
|
jira="../jira"
|
||||||
export JIRA_LOG_FORMAT="%{level:-5s} %{message}"
|
. env.sh
|
||||||
|
|
||||||
ENDPOINT="http://localhost:8080"
|
|
||||||
if [ -n "$JIRACLOUD" ]; then
|
|
||||||
ENDPOINT="https://go-jira.atlassian.net"
|
|
||||||
fi
|
|
||||||
|
|
||||||
PLAN 86
|
PLAN 86
|
||||||
|
|
||||||
@@ -40,8 +35,8 @@ status: Backlog
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: KANBAN
|
project: KANBAN
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
priority: Medium
|
priority: Medium
|
||||||
votes: 0
|
votes: 0
|
||||||
description: |
|
description: |
|
||||||
@@ -119,8 +114,8 @@ status: Backlog
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: KANBAN
|
project: KANBAN
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -166,8 +161,8 @@ status: Backlog
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: KANBAN
|
project: KANBAN
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[Backlog]
|
blockers: $blocker[Backlog]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -190,7 +185,7 @@ EOF
|
|||||||
# reset login for mothra for voting
|
# reset login for mothra for voting
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
jira="$jira --user mothra"
|
jira="$jira --user mothra --login mothra@corybennett.org"
|
||||||
|
|
||||||
RUNS $jira logout
|
RUNS $jira logout
|
||||||
echo "mothra123" | RUNS $jira login
|
echo "mothra123" | RUNS $jira login
|
||||||
@@ -212,8 +207,8 @@ status: Backlog
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: KANBAN
|
project: KANBAN
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[Backlog]
|
blockers: $blocker[Backlog]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -239,8 +234,8 @@ status: Backlog
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: KANBAN
|
project: KANBAN
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[Backlog]
|
blockers: $blocker[Backlog]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -259,10 +254,10 @@ OK $issue $ENDPOINT/browse/$issue
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
# FIXME we probably need a watchers command to wrap this?
|
# FIXME we probably need a watchers command to wrap this?
|
||||||
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].name | sort"
|
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].displayName | sort"
|
||||||
DIFF <<EOF
|
DIFF <<EOF
|
||||||
gojira
|
GoJira
|
||||||
mothra
|
Mothra
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -340,8 +335,8 @@ status: Backlog
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: KANBAN
|
project: KANBAN
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[Done]
|
blockers: $blocker[Done]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -367,8 +362,8 @@ status: Backlog
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: KANBAN
|
project: KANBAN
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[Done]
|
blockers: $blocker[Done]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -377,7 +372,7 @@ description: |
|
|||||||
description
|
description
|
||||||
|
|
||||||
comments:
|
comments:
|
||||||
- | # mothra, a minute ago
|
- | # Mothra, a minute ago
|
||||||
Yo, Comment
|
Yo, Comment
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
@@ -399,8 +394,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: KANBAN
|
project: KANBAN
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[Backlog]
|
depends: $issue[Backlog]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -427,8 +422,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: KANBAN
|
project: KANBAN
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[Backlog]
|
depends: $issue[Backlog]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -455,8 +450,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: KANBAN
|
project: KANBAN
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[Backlog]
|
depends: $issue[Backlog]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -483,8 +478,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: KANBAN
|
project: KANBAN
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: mothra
|
assignee: Mothra
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[Backlog]
|
depends: $issue[Backlog]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -511,8 +506,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: KANBAN
|
project: KANBAN
|
||||||
issuetype: Bug
|
issuetype: Bug
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[Backlog]
|
depends: $issue[Backlog]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -2,12 +2,7 @@
|
|||||||
eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)"
|
eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)"
|
||||||
cd $(dirname $0)
|
cd $(dirname $0)
|
||||||
jira="../jira"
|
jira="../jira"
|
||||||
export JIRA_LOG_FORMAT="%{level:-5s} %{message}"
|
. env.sh
|
||||||
|
|
||||||
ENDPOINT="http://localhost:8080"
|
|
||||||
if [ -n "$JIRACLOUD" ]; then
|
|
||||||
ENDPOINT="https://go-jira.atlassian.net"
|
|
||||||
fi
|
|
||||||
|
|
||||||
PLAN 84
|
PLAN 84
|
||||||
|
|
||||||
@@ -40,8 +35,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: PROJECT
|
project: PROJECT
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
priority: Medium
|
priority: Medium
|
||||||
votes: 0
|
votes: 0
|
||||||
description: |
|
description: |
|
||||||
@@ -119,8 +114,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: PROJECT
|
project: PROJECT
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -166,8 +161,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: PROJECT
|
project: PROJECT
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[To Do]
|
blockers: $blocker[To Do]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -190,7 +185,7 @@ EOF
|
|||||||
# reset login for mothra for voting
|
# reset login for mothra for voting
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
jira="$jira --user mothra"
|
jira="$jira --user mothra --login mothra@corybennett.org"
|
||||||
|
|
||||||
RUNS $jira logout
|
RUNS $jira logout
|
||||||
echo "mothra123" | RUNS $jira login
|
echo "mothra123" | RUNS $jira login
|
||||||
@@ -212,8 +207,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: PROJECT
|
project: PROJECT
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[To Do]
|
blockers: $blocker[To Do]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -239,8 +234,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: PROJECT
|
project: PROJECT
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[To Do]
|
blockers: $blocker[To Do]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -259,10 +254,10 @@ OK $issue $ENDPOINT/browse/$issue
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
# FIXME we probably need a watchers command to wrap this?
|
# FIXME we probably need a watchers command to wrap this?
|
||||||
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].name | sort"
|
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].displayName | sort"
|
||||||
DIFF <<EOF
|
DIFF <<EOF
|
||||||
gojira
|
GoJira
|
||||||
mothra
|
Mothra
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -301,8 +296,8 @@ status: In Progress
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: PROJECT
|
project: PROJECT
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: mothra
|
assignee: Mothra
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[To Do]
|
depends: $issue[To Do]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -342,8 +337,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: PROJECT
|
project: PROJECT
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[Done]
|
blockers: $blocker[Done]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -369,8 +364,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: PROJECT
|
project: PROJECT
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[Done]
|
blockers: $blocker[Done]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -379,7 +374,7 @@ description: |
|
|||||||
description
|
description
|
||||||
|
|
||||||
comments:
|
comments:
|
||||||
- | # mothra, a minute ago
|
- | # Mothra, a minute ago
|
||||||
Yo, Comment
|
Yo, Comment
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
@@ -401,8 +396,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: PROJECT
|
project: PROJECT
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: mothra
|
assignee: Mothra
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[To Do]
|
depends: $issue[To Do]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -429,8 +424,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: PROJECT
|
project: PROJECT
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: mothra
|
assignee: Mothra
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[To Do]
|
depends: $issue[To Do]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -457,8 +452,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: PROJECT
|
project: PROJECT
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: mothra
|
assignee: Mothra
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[To Do]
|
depends: $issue[To Do]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -485,8 +480,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: PROJECT
|
project: PROJECT
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[To Do]
|
depends: $issue[To Do]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -513,8 +508,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: PROJECT
|
project: PROJECT
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: mothra
|
assignee: Mothra
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[To Do]
|
depends: $issue[To Do]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -2,12 +2,7 @@
|
|||||||
eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)"
|
eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)"
|
||||||
cd $(dirname $0)
|
cd $(dirname $0)
|
||||||
jira="../jira"
|
jira="../jira"
|
||||||
export JIRA_LOG_FORMAT="%{level:-5s} %{message}"
|
. env.sh
|
||||||
|
|
||||||
ENDPOINT="http://localhost:8080"
|
|
||||||
if [ -n "$JIRACLOUD" ]; then
|
|
||||||
ENDPOINT="https://go-jira.atlassian.net"
|
|
||||||
fi
|
|
||||||
|
|
||||||
PLAN 84
|
PLAN 84
|
||||||
|
|
||||||
@@ -15,6 +10,10 @@ PLAN 84
|
|||||||
($jira ls --project PROCESS | awk -F: '{print $1}' | while read issue; do ../jira start $issue; done) | sed 's/^/# CLEANUP: /g'
|
($jira ls --project PROCESS | awk -F: '{print $1}' | while read issue; do ../jira start $issue; done) | sed 's/^/# CLEANUP: /g'
|
||||||
($jira ls --project PROCESS | awk -F: '{print $1}' | while read issue; do ../jira stop $issue; done) | sed 's/^/# CLEANUP: /g'
|
($jira ls --project PROCESS | awk -F: '{print $1}' | while read issue; do ../jira stop $issue; done) | sed 's/^/# CLEANUP: /g'
|
||||||
|
|
||||||
|
# for any issues still remaining, they are stuck in "Under Review" status
|
||||||
|
($jira ls --project PROCESS | awk -F: '{print $1}' | while read issue; do ../jira transition --noedit -m "approve" "Approve" $issue; done) | sed 's/^/# CLEANUP: /g'
|
||||||
|
($jira ls --project PROCESS | awk -F: '{print $1}' | while read issue; do ../jira transition --noedit -m "done" "Done" $issue; done) | sed 's/^/# CLEANUP: /g'
|
||||||
|
|
||||||
# reset login
|
# reset login
|
||||||
RUNS $jira logout
|
RUNS $jira logout
|
||||||
echo "gojira123" | RUNS $jira login
|
echo "gojira123" | RUNS $jira login
|
||||||
@@ -41,8 +40,8 @@ status: Open
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: PROCESS
|
project: PROCESS
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
priority: Medium
|
priority: Medium
|
||||||
votes: 0
|
votes: 0
|
||||||
description: |
|
description: |
|
||||||
@@ -128,8 +127,8 @@ status: Open
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: PROCESS
|
project: PROCESS
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $dup[Cancelled]
|
depends: $dup[Cancelled]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -175,8 +174,8 @@ status: Open
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: PROCESS
|
project: PROCESS
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[Open]
|
blockers: $blocker[Open]
|
||||||
depends: $dup[Cancelled]
|
depends: $dup[Cancelled]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -199,7 +198,7 @@ EOF
|
|||||||
# reset login for mothra for voting
|
# reset login for mothra for voting
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
jira="$jira --user mothra"
|
jira="$jira --user mothra --login mothra@corybennett.org"
|
||||||
|
|
||||||
RUNS $jira logout
|
RUNS $jira logout
|
||||||
echo "mothra123" | RUNS $jira login
|
echo "mothra123" | RUNS $jira login
|
||||||
@@ -221,8 +220,8 @@ status: Open
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: PROCESS
|
project: PROCESS
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[Open]
|
blockers: $blocker[Open]
|
||||||
depends: $dup[Cancelled]
|
depends: $dup[Cancelled]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -248,8 +247,8 @@ status: Open
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: PROCESS
|
project: PROCESS
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[Open]
|
blockers: $blocker[Open]
|
||||||
depends: $dup[Cancelled]
|
depends: $dup[Cancelled]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -268,10 +267,10 @@ OK $issue $ENDPOINT/browse/$issue
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
# FIXME we probably need a watchers command to wrap this?
|
# FIXME we probably need a watchers command to wrap this?
|
||||||
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].name | sort"
|
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].displayName | sort"
|
||||||
DIFF <<EOF
|
DIFF <<EOF
|
||||||
gojira
|
GoJira
|
||||||
mothra
|
Mothra
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -333,8 +332,8 @@ status: Open
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: PROCESS
|
project: PROCESS
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[Open]
|
blockers: $blocker[Open]
|
||||||
depends: $dup[Cancelled]
|
depends: $dup[Cancelled]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -360,8 +359,8 @@ status: Open
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: PROCESS
|
project: PROCESS
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[Open]
|
blockers: $blocker[Open]
|
||||||
depends: $dup[Cancelled]
|
depends: $dup[Cancelled]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -370,7 +369,7 @@ description: |
|
|||||||
description
|
description
|
||||||
|
|
||||||
comments:
|
comments:
|
||||||
- | # mothra, a minute ago
|
- | # Mothra, a minute ago
|
||||||
Yo, Comment
|
Yo, Comment
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
@@ -392,8 +391,8 @@ status: Open
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: PROCESS
|
project: PROCESS
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[Open]
|
depends: $issue[Open]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -420,8 +419,8 @@ status: Open
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: PROCESS
|
project: PROCESS
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[Open]
|
depends: $issue[Open]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -448,8 +447,8 @@ status: Open
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: PROCESS
|
project: PROCESS
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[Open]
|
depends: $issue[Open]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -476,8 +475,8 @@ status: Open
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: PROCESS
|
project: PROCESS
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: mothra
|
assignee: Mothra
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[Open]
|
depends: $issue[Open]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -504,8 +503,8 @@ status: Open
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: PROCESS
|
project: PROCESS
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[Open]
|
depends: $issue[Open]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
+30
-35
@@ -2,12 +2,7 @@
|
|||||||
eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)"
|
eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)"
|
||||||
cd $(dirname $0)
|
cd $(dirname $0)
|
||||||
jira="../jira"
|
jira="../jira"
|
||||||
export JIRA_LOG_FORMAT="%{level:-5s} %{message}"
|
. env.sh
|
||||||
|
|
||||||
ENDPOINT="http://localhost:8080"
|
|
||||||
if [ -n "$JIRACLOUD" ]; then
|
|
||||||
ENDPOINT="https://go-jira.atlassian.net"
|
|
||||||
fi
|
|
||||||
|
|
||||||
PLAN 82
|
PLAN 82
|
||||||
|
|
||||||
@@ -40,8 +35,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: TASK
|
project: TASK
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
priority: Medium
|
priority: Medium
|
||||||
votes: 0
|
votes: 0
|
||||||
description: |
|
description: |
|
||||||
@@ -121,8 +116,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: TASK
|
project: TASK
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -168,8 +163,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: TASK
|
project: TASK
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[To Do]
|
blockers: $blocker[To Do]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -192,7 +187,7 @@ EOF
|
|||||||
# reset login for mothra for voting
|
# reset login for mothra for voting
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
jira="$jira --user mothra"
|
jira="$jira --user mothra --login mothra@corybennett.org"
|
||||||
|
|
||||||
RUNS $jira logout
|
RUNS $jira logout
|
||||||
echo "mothra123" | RUNS $jira login
|
echo "mothra123" | RUNS $jira login
|
||||||
@@ -214,8 +209,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: TASK
|
project: TASK
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[To Do]
|
blockers: $blocker[To Do]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -241,8 +236,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: TASK
|
project: TASK
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[To Do]
|
blockers: $blocker[To Do]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -261,10 +256,10 @@ OK $issue $ENDPOINT/browse/$issue
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
# FIXME we probably need a watchers command to wrap this?
|
# FIXME we probably need a watchers command to wrap this?
|
||||||
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].name | sort"
|
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].displayName | sort"
|
||||||
DIFF <<EOF
|
DIFF <<EOF
|
||||||
gojira
|
GoJira
|
||||||
mothra
|
Mothra
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -326,8 +321,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: TASK
|
project: TASK
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[Done]
|
blockers: $blocker[Done]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -353,8 +348,8 @@ status: To Do
|
|||||||
summary: summary
|
summary: summary
|
||||||
project: TASK
|
project: TASK
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers: $blocker[Done]
|
blockers: $blocker[Done]
|
||||||
depends: $dup[Done]
|
depends: $dup[Done]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -363,7 +358,7 @@ description: |
|
|||||||
description
|
description
|
||||||
|
|
||||||
comments:
|
comments:
|
||||||
- | # mothra, a minute ago
|
- | # Mothra, a minute ago
|
||||||
Yo, Comment
|
Yo, Comment
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
@@ -385,8 +380,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: TASK
|
project: TASK
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[To Do]
|
depends: $issue[To Do]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -413,8 +408,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: TASK
|
project: TASK
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[To Do]
|
depends: $issue[To Do]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -441,8 +436,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: TASK
|
project: TASK
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[To Do]
|
depends: $issue[To Do]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -469,8 +464,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: TASK
|
project: TASK
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: mothra
|
assignee: Mothra
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[To Do]
|
depends: $issue[To Do]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -497,8 +492,8 @@ status: Done
|
|||||||
summary: blocks
|
summary: blocks
|
||||||
project: TASK
|
project: TASK
|
||||||
issuetype: Task
|
issuetype: Task
|
||||||
assignee: gojira
|
assignee: GoJira
|
||||||
reporter: gojira
|
reporter: GoJira
|
||||||
blockers:
|
blockers:
|
||||||
depends: $issue[To Do]
|
depends: $issue[To Do]
|
||||||
priority: Medium
|
priority: Medium
|
||||||
@@ -9,7 +9,7 @@ From the top level of the project you can run:
|
|||||||
# this creates a local "jira" binary
|
# this creates a local "jira" binary
|
||||||
make
|
make
|
||||||
|
|
||||||
# this runs the integration tests in the "t" directory
|
# this runs the integration tests in the "_t" directory
|
||||||
prove
|
prove
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<jira.version>7.2.0</jira.version>
|
<jira.version>7.2.0</jira.version>
|
||||||
<amps.version>6.2.6</amps.version>
|
<amps.version>6.3.15</amps.version>
|
||||||
<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
|
<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
|
||||||
<atlassian.spring.scanner.version>1.2.13</atlassian.spring.scanner.version>
|
<atlassian.spring.scanner.version>1.2.13</atlassian.spring.scanner.version>
|
||||||
<!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. -->
|
<!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. -->
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
export COLUMNS=149
|
||||||
|
export JIRA_LOG_FORMAT="%{level:-5s} %{message}"
|
||||||
|
export ENDPOINT="https://go-jira.atlassian.net"
|
||||||
|
export GNUPGHOME=$(pwd)/.gnupg
|
||||||
|
export PASSWORD_STORE_DIR=$(pwd)/.password-store
|
||||||
|
export JIRACLOUD=1
|
||||||
|
|
||||||
Executable
+40
@@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#dist/github.com/go-jira/jira-darwin-amd64 dist/github.com/go-jira/jira-linux-amd64 dist/github.com/go-jira/jira-windows-amd64.exe
|
||||||
|
#dist/github.com/go-jira/jira-linux-386 dist/github.com/go-jira/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
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package jira
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
|
||||||
|
"github.com/go-jira/jira/jiradata"
|
||||||
|
)
|
||||||
|
|
||||||
|
// https://docs.atlassian.com/jira/REST/cloud/#api/2/attachment-getAttachment
|
||||||
|
func (j *Jira) GetAttachment(id string) (*jiradata.Attachment, error) {
|
||||||
|
return GetAttachment(j.UA, j.Endpoint, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetAttachment(ua HttpClient, endpoint string, id string) (*jiradata.Attachment, error) {
|
||||||
|
uri := URLJoin(endpoint, "rest/api/2/attachment", id)
|
||||||
|
resp, err := ua.GetJSON(uri)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
if resp.StatusCode == 200 {
|
||||||
|
results := &jiradata.Attachment{}
|
||||||
|
return results, json.NewDecoder(resp.Body).Decode(results)
|
||||||
|
}
|
||||||
|
return nil, responseError(resp)
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://docs.atlassian.com/jira/REST/cloud/#api/2/attachment-removeAttachment
|
||||||
|
func (j *Jira) RemoveAttachment(id string) error {
|
||||||
|
return RemoveAttachment(j.UA, j.Endpoint, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
func RemoveAttachment(ua HttpClient, endpoint string, id string) error {
|
||||||
|
uri := URLJoin(endpoint, "rest/api/2/attachment", id)
|
||||||
|
resp, err := ua.Delete(uri)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
if resp.StatusCode == 204 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return responseError(resp)
|
||||||
|
}
|
||||||
+28
-328
@@ -1,354 +1,54 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"reflect"
|
||||||
"runtime/debug"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/coryb/figtree"
|
"github.com/coryb/figtree"
|
||||||
"github.com/coryb/kingpeon"
|
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
|
|
||||||
jira "gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
"github.com/go-jira/jira/jiracli"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
"github.com/go-jira/jira/jiracmd"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracmd"
|
"gopkg.in/coryb/yaml.v2"
|
||||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
|
||||||
"gopkg.in/op/go-logging.v1"
|
"gopkg.in/op/go-logging.v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
type oreoLogger struct {
|
||||||
log = logging.MustGetLogger("jira")
|
logger *logging.Logger
|
||||||
defaultFormat = func() string {
|
|
||||||
format := os.Getenv("JIRA_LOG_FORMAT")
|
|
||||||
if format != "" {
|
|
||||||
return format
|
|
||||||
}
|
|
||||||
return "%{color}%{level:-5s}%{color:reset} %{message}"
|
|
||||||
}()
|
|
||||||
)
|
|
||||||
|
|
||||||
func handleExit() {
|
|
||||||
if e := recover(); e != nil {
|
|
||||||
if exit, ok := e.(jiracli.Exit); ok {
|
|
||||||
os.Exit(exit.Code)
|
|
||||||
} else {
|
|
||||||
fmt.Fprintf(os.Stderr, "%s\n%s", e, debug.Stack())
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func increaseLogLevel(verbosity int) {
|
var log = logging.MustGetLogger("jira")
|
||||||
logging.SetLevel(logging.GetLevel("")+logging.Level(verbosity), "")
|
|
||||||
if logging.GetLevel("") > logging.DEBUG {
|
func (ol *oreoLogger) Printf(format string, args ...interface{}) {
|
||||||
oreo.TraceRequestBody = true
|
ol.logger.Debugf(format, args...)
|
||||||
oreo.TraceResponseBody = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
defer handleExit()
|
defer jiracli.HandleExit()
|
||||||
logBackend := logging.NewLogBackend(os.Stderr, "", 0)
|
|
||||||
format := os.Getenv("JIRA_LOG_FORMAT")
|
jiracli.InitLogging()
|
||||||
if format == "" {
|
|
||||||
format = defaultFormat
|
configDir := ".jira.d"
|
||||||
}
|
|
||||||
logging.SetBackend(
|
yaml.UseMapType(reflect.TypeOf(map[string]interface{}{}))
|
||||||
logging.NewBackendFormatter(
|
defer yaml.RestoreMapType()
|
||||||
logBackend,
|
|
||||||
logging.MustStringFormatter(format),
|
fig := figtree.NewFigTree(
|
||||||
),
|
figtree.WithHome(jiracli.Homedir()),
|
||||||
|
figtree.WithEnvPrefix("JIRA"),
|
||||||
|
figtree.WithConfigDir(configDir),
|
||||||
)
|
)
|
||||||
if os.Getenv("JIRA_DEBUG") == "" {
|
|
||||||
logging.SetLevel(logging.NOTICE, "")
|
|
||||||
} else {
|
|
||||||
logging.SetLevel(logging.DEBUG, "")
|
|
||||||
}
|
|
||||||
|
|
||||||
app := kingpin.New("jira", "Jira Command Line Interface")
|
if err := os.MkdirAll(filepath.Join(jiracli.Homedir(), configDir), 0755); err != nil {
|
||||||
app.Command("version", "Prints version").PreAction(func(*kingpin.ParseContext) error {
|
|
||||||
fmt.Println(jira.VERSION)
|
|
||||||
panic(jiracli.Exit{Code: 0})
|
|
||||||
})
|
|
||||||
|
|
||||||
var verbosity int
|
|
||||||
app.Flag("verbose", "Increase verbosity for debugging").Short('v').PreAction(func(_ *kingpin.ParseContext) error {
|
|
||||||
os.Setenv("JIRA_DEBUG", fmt.Sprintf("%d", verbosity))
|
|
||||||
increaseLogLevel(1)
|
|
||||||
return nil
|
|
||||||
}).CounterVar(&verbosity)
|
|
||||||
|
|
||||||
if os.Getenv("JIRA_DEBUG") != "" {
|
|
||||||
if verbosity, err := strconv.Atoi(os.Getenv("JIRA_DEBUG")); err == nil {
|
|
||||||
increaseLogLevel(verbosity)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fig := figtree.NewFigTree()
|
|
||||||
fig.EnvPrefix = "JIRA"
|
|
||||||
fig.ConfigDir = ".jira.d"
|
|
||||||
|
|
||||||
if err := os.MkdirAll(filepath.Join(jiracli.Homedir(), fig.ConfigDir), 0755); err != nil {
|
|
||||||
log.Errorf("%s", err)
|
log.Errorf("%s", err)
|
||||||
panic(jiracli.Exit{Code: 1})
|
panic(jiracli.Exit{Code: 1})
|
||||||
}
|
}
|
||||||
|
|
||||||
o := oreo.New().WithCookieFile(filepath.Join(jiracli.Homedir(), fig.ConfigDir, "cookies.js"))
|
o := oreo.New().WithCookieFile(filepath.Join(jiracli.Homedir(), configDir, "cookies.js")).WithLogger(&oreoLogger{log})
|
||||||
|
|
||||||
registry := []jiracli.CommandRegistry{
|
jiracmd.RegisterAllCommands()
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "login",
|
|
||||||
Entry: jiracmd.CmdLoginRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "logout",
|
|
||||||
Entry: jiracmd.CmdLogoutRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "list",
|
|
||||||
Aliases: []string{"ls"},
|
|
||||||
Entry: jiracmd.CmdListRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "view",
|
|
||||||
Entry: jiracmd.CmdViewRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "create",
|
|
||||||
Entry: jiracmd.CmdCreateRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "edit",
|
|
||||||
Entry: jiracmd.CmdEditRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "comment",
|
|
||||||
Entry: jiracmd.CmdCommentRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "worklog list",
|
|
||||||
Entry: jiracmd.CmdWorklogListRegistry(),
|
|
||||||
Default: true,
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "worklog add",
|
|
||||||
Entry: jiracmd.CmdWorklogAddRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "fields",
|
|
||||||
Entry: jiracmd.CmdFieldsRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "createmeta",
|
|
||||||
Entry: jiracmd.CmdCreateMetaRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "editmeta",
|
|
||||||
Entry: jiracmd.CmdEditMetaRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "subtask",
|
|
||||||
Entry: jiracmd.CmdSubtaskRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "dup",
|
|
||||||
Entry: jiracmd.CmdDupRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "block",
|
|
||||||
Entry: jiracmd.CmdBlockRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "issuelink",
|
|
||||||
Entry: jiracmd.CmdIssueLinkRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "issuelinktypes",
|
|
||||||
Entry: jiracmd.CmdIssueLinkTypesRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "transition",
|
|
||||||
Aliases: []string{"trans"},
|
|
||||||
Entry: jiracmd.CmdTransitionRegistry(""),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "transitions",
|
|
||||||
Entry: jiracmd.CmdTransitionsRegistry("transitions"),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "transmeta",
|
|
||||||
Entry: jiracmd.CmdTransitionsRegistry("debug"),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "close",
|
|
||||||
Entry: jiracmd.CmdTransitionRegistry("close"),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "acknowledge",
|
|
||||||
Aliases: []string{"ack"},
|
|
||||||
Entry: jiracmd.CmdTransitionRegistry("acknowledge"),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "reopen",
|
|
||||||
Entry: jiracmd.CmdTransitionRegistry("reopen"),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "resolve",
|
|
||||||
Entry: jiracmd.CmdTransitionRegistry("resolve"),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "start",
|
|
||||||
Entry: jiracmd.CmdTransitionRegistry("start"),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "stop",
|
|
||||||
Entry: jiracmd.CmdTransitionRegistry("stop"),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "todo",
|
|
||||||
Entry: jiracmd.CmdTransitionRegistry("To Do"),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "backlog",
|
|
||||||
Entry: jiracmd.CmdTransitionRegistry("Backlog"),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "done",
|
|
||||||
Entry: jiracmd.CmdTransitionRegistry("Done"),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "in-progress",
|
|
||||||
Aliases: []string{"prog", "progress"},
|
|
||||||
Entry: jiracmd.CmdTransitionRegistry("Progress"),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "vote",
|
|
||||||
Entry: jiracmd.CmdVoteRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "rank",
|
|
||||||
Entry: jiracmd.CmdRankRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "watch",
|
|
||||||
Entry: jiracmd.CmdWatchRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "labels add",
|
|
||||||
Entry: jiracmd.CmdLabelsAddRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "labels set",
|
|
||||||
Entry: jiracmd.CmdLabelsSetRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "labels remove",
|
|
||||||
Entry: jiracmd.CmdLabelsRemoveRegistry(),
|
|
||||||
Aliases: []string{"rm"},
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "take",
|
|
||||||
Entry: jiracmd.CmdTakeRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "assign",
|
|
||||||
Entry: jiracmd.CmdAssignRegistry(),
|
|
||||||
Aliases: []string{"give"},
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "unassign",
|
|
||||||
Entry: jiracmd.CmdUnassignRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "component add",
|
|
||||||
Entry: jiracmd.CmdComponentAddRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "components",
|
|
||||||
Entry: jiracmd.CmdComponentsRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "issuetypes",
|
|
||||||
Entry: jiracmd.CmdIssueTypesRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "export-templates",
|
|
||||||
Entry: jiracmd.CmdExportTemplatesRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "unexport-templates",
|
|
||||||
Entry: jiracmd.CmdUnexportTemplatesRegistry(),
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "browse",
|
|
||||||
Entry: jiracmd.CmdBrowseRegistry(),
|
|
||||||
Aliases: []string{"b"},
|
|
||||||
},
|
|
||||||
jiracli.CommandRegistry{
|
|
||||||
Command: "request",
|
|
||||||
Entry: jiracmd.CmdRequestRegistry(),
|
|
||||||
Aliases: []string{"req"},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
jiracli.Register(app, o, fig, registry)
|
app := jiracli.CommandLine(fig, o)
|
||||||
|
jiracli.ParseCommandLine(app, os.Args[1:])
|
||||||
// register custom commands
|
|
||||||
data := struct {
|
|
||||||
CustomCommands kingpeon.DynamicCommands `yaml:"custom-commands" json:"custom-commands"`
|
|
||||||
}{}
|
|
||||||
|
|
||||||
if err := fig.LoadAllConfigs("config.yml", &data); err != nil {
|
|
||||||
log.Errorf("%s", err)
|
|
||||||
panic(jiracli.Exit{Code: 1})
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(data.CustomCommands) > 0 {
|
|
||||||
tmp := map[string]interface{}{}
|
|
||||||
fig.LoadAllConfigs("config.yml", &tmp)
|
|
||||||
kingpeon.RegisterDynamicCommands(app, data.CustomCommands, jiracli.TemplateProcessor())
|
|
||||||
}
|
|
||||||
|
|
||||||
app.Terminate(func(status int) {
|
|
||||||
for _, arg := range os.Args {
|
|
||||||
if arg == "-h" || arg == "--help" || len(os.Args) == 1 {
|
|
||||||
panic(jiracli.Exit{Code: 0})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
panic(jiracli.Exit{Code: 1})
|
|
||||||
})
|
|
||||||
|
|
||||||
// checking for default usage of `jira ISSUE-123` but need to allow
|
|
||||||
// for global options first like: `jira --user mothra ISSUE-123`
|
|
||||||
ctx, _ := app.ParseContext(os.Args[1:])
|
|
||||||
if ctx != nil {
|
|
||||||
if ctx.SelectedCommand == nil {
|
|
||||||
next := ctx.Next()
|
|
||||||
if next != nil {
|
|
||||||
if ok, err := regexp.MatchString("^[A-Z]+-[0-9]+$", next.Value); err != nil {
|
|
||||||
log.Errorf("Invalid Regex: %s", err)
|
|
||||||
} else if ok {
|
|
||||||
// insert "view" at i=1 (2nd position)
|
|
||||||
os.Args = append(os.Args[:1], append([]string{"view"}, os.Args[1:]...)...)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err := app.Parse(os.Args[1:]); err != nil {
|
|
||||||
if _, ok := err.(*jiracli.Error); ok {
|
|
||||||
log.Errorf("%s", err)
|
|
||||||
panic(jiracli.Exit{Code: 1})
|
|
||||||
} else {
|
|
||||||
ctx, _ := app.ParseContext(os.Args[1:])
|
|
||||||
if ctx != nil {
|
|
||||||
app.UsageForContext(ctx)
|
|
||||||
}
|
|
||||||
log.Errorf("Invalid Usage: %s", err)
|
|
||||||
panic(jiracli.Exit{Code: 1})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-4
@@ -3,9 +3,8 @@ package jira
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
"github.com/go-jira/jira/jiradata"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ComponentProvider interface {
|
type ComponentProvider interface {
|
||||||
@@ -23,7 +22,7 @@ func CreateComponent(ua HttpClient, endpoint string, cp ComponentProvider) (*jir
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
uri := fmt.Sprintf("%s/rest/api/2/component", endpoint)
|
uri := URLJoin(endpoint, "rest/api/2/component")
|
||||||
resp, err := ua.Post(uri, "application/json", bytes.NewBuffer(encoded))
|
resp, err := ua.Post(uri, "application/json", bytes.NewBuffer(encoded))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -32,7 +31,7 @@ func CreateComponent(ua HttpClient, endpoint string, cp ComponentProvider) (*jir
|
|||||||
|
|
||||||
if resp.StatusCode == 201 {
|
if resp.StatusCode == 201 {
|
||||||
results := &jiradata.Component{}
|
results := &jiradata.Component{}
|
||||||
return results, readJSON(resp.Body, results)
|
return results, json.NewDecoder(resp.Body).Decode(results)
|
||||||
}
|
}
|
||||||
return nil, responseError(resp)
|
return nil, responseError(resp)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,113 @@
|
|||||||
|
package jira
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"net/url"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/coryb/oreo"
|
||||||
|
|
||||||
|
"github.com/go-jira/jira/jiradata"
|
||||||
|
)
|
||||||
|
|
||||||
|
// https://docs.atlassian.com/jira-software/REST/latest/#agile/1.0/epic-getIssuesForEpic
|
||||||
|
func (j *Jira) EpicSearch(epic string, sp SearchProvider) (*jiradata.SearchResults, error) {
|
||||||
|
return EpicSearch(j.UA, j.Endpoint, epic, sp)
|
||||||
|
}
|
||||||
|
|
||||||
|
func EpicSearch(ua HttpClient, endpoint string, epic string, sp SearchProvider) (*jiradata.SearchResults, error) {
|
||||||
|
req := sp.ProvideSearchRequest()
|
||||||
|
// encoded, err := json.Marshal(req)
|
||||||
|
// if err != nil {
|
||||||
|
// return nil, err
|
||||||
|
// }
|
||||||
|
uri, err := url.Parse(URLJoin(endpoint, "rest/agile/1.0/epic", epic, "issue"))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
params := url.Values{}
|
||||||
|
if len(req.Fields) > 0 {
|
||||||
|
params.Add("fields", strings.Join(req.Fields, ","))
|
||||||
|
}
|
||||||
|
if req.JQL != "" {
|
||||||
|
params.Add("jql", req.JQL)
|
||||||
|
}
|
||||||
|
if req.MaxResults != 0 {
|
||||||
|
params.Add("maxResults", fmt.Sprintf("%d", req.MaxResults))
|
||||||
|
}
|
||||||
|
if req.StartAt != 0 {
|
||||||
|
params.Add("startAt", fmt.Sprintf("%d", req.StartAt))
|
||||||
|
}
|
||||||
|
if req.ValidateQuery != "" {
|
||||||
|
params.Add("validateQuery", req.ValidateQuery)
|
||||||
|
}
|
||||||
|
uri.RawQuery = params.Encode()
|
||||||
|
|
||||||
|
resp, err := ua.Do(oreo.RequestBuilder(uri).WithHeader("Accept", "application/json").Build())
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
if resp.StatusCode == 200 {
|
||||||
|
results := &jiradata.SearchResults{}
|
||||||
|
return results, json.NewDecoder(resp.Body).Decode(results)
|
||||||
|
}
|
||||||
|
return nil, responseError(resp)
|
||||||
|
}
|
||||||
|
|
||||||
|
type EpicIssuesProvider interface {
|
||||||
|
ProvideEpicIssues() *jiradata.EpicIssues
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://docs.atlassian.com/jira-software/REST/latest/#agile/1.0/epic-moveIssuesToEpic
|
||||||
|
func (j *Jira) EpicAddIssues(epic string, eip EpicIssuesProvider) error {
|
||||||
|
return EpicAddIssues(j.UA, j.Endpoint, epic, eip)
|
||||||
|
}
|
||||||
|
|
||||||
|
func EpicAddIssues(ua HttpClient, endpoint string, epic string, eip EpicIssuesProvider) error {
|
||||||
|
req := eip.ProvideEpicIssues()
|
||||||
|
encoded, err := json.Marshal(req)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
uri := URLJoin(endpoint, "rest/agile/1.0/epic", epic, "issue")
|
||||||
|
resp, err := ua.Post(uri, "application/json", bytes.NewBuffer(encoded))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
if resp.StatusCode == 204 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return responseError(resp)
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://docs.atlassian.com/jira-software/REST/latest/#agile/1.0/epic-removeIssuesFromEpic
|
||||||
|
func (j *Jira) EpicRemoveIssues(eip EpicIssuesProvider) error {
|
||||||
|
return EpicRemoveIssues(j.UA, j.Endpoint, eip)
|
||||||
|
}
|
||||||
|
|
||||||
|
func EpicRemoveIssues(ua HttpClient, endpoint string, eip EpicIssuesProvider) error {
|
||||||
|
req := eip.ProvideEpicIssues()
|
||||||
|
encoded, err := json.Marshal(req)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
uri := URLJoin(endpoint, "rest/agile/1.0/epic/none/issue")
|
||||||
|
resp, err := ua.Post(uri, "application/json", bytes.NewBuffer(encoded))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
if resp.StatusCode == 204 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return responseError(resp)
|
||||||
|
}
|
||||||
@@ -1,19 +1,21 @@
|
|||||||
package jira
|
package jira
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
"github.com/go-jira/jira/jiradata"
|
||||||
)
|
)
|
||||||
|
|
||||||
func responseError(resp *http.Response) error {
|
func responseError(resp *http.Response) error {
|
||||||
results := &jiradata.ErrorCollection{}
|
results := &jiradata.ErrorCollection{}
|
||||||
if err := readJSON(resp.Body, results); err != nil {
|
if err := json.NewDecoder(resp.Body).Decode(results); err != nil {
|
||||||
return err
|
results.Status = resp.StatusCode
|
||||||
|
results.ErrorMessages = append(results.ErrorMessages, err.Error())
|
||||||
}
|
}
|
||||||
if len(results.ErrorMessages) == 0 && len(results.Errors) == 0 {
|
if len(results.ErrorMessages) == 0 && len(results.Errors) == 0 {
|
||||||
return fmt.Errorf(resp.Status)
|
results.Status = resp.StatusCode
|
||||||
|
results.ErrorMessages = append(results.ErrorMessages, resp.Status)
|
||||||
}
|
}
|
||||||
return results
|
return results
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package jira
|
package jira
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"encoding/json"
|
||||||
|
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/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
|
||||||
@@ -12,7 +12,7 @@ func (j *Jira) GetFields() ([]jiradata.Field, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetFields(ua HttpClient, endpoint string) ([]jiradata.Field, error) {
|
func GetFields(ua HttpClient, endpoint string) ([]jiradata.Field, error) {
|
||||||
uri := fmt.Sprintf("%s/rest/api/2/field", endpoint)
|
uri := URLJoin(endpoint, "rest/api/2/field")
|
||||||
resp, err := ua.GetJSON(uri)
|
resp, err := ua.GetJSON(uri)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -20,7 +20,7 @@ func GetFields(ua HttpClient, endpoint string) ([]jiradata.Field, error) {
|
|||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
if resp.StatusCode == 200 {
|
if resp.StatusCode == 200 {
|
||||||
results := []jiradata.Field{}
|
results := []jiradata.Field{}
|
||||||
return results, readJSON(resp.Body, &results)
|
return results, json.NewDecoder(resp.Body).Decode(&results)
|
||||||
}
|
}
|
||||||
return nil, responseError(resp)
|
return nil, responseError(resp)
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
-64
@@ -1,64 +0,0 @@
|
|||||||
hash: 4c3ae9c9421b17aae9987ea9566cac7d0a789750bb77c8d235b7be163aec8cae
|
|
||||||
updated: 2017-09-06T11:32:06.307462177-07:00
|
|
||||||
imports:
|
|
||||||
- name: github.com/alecthomas/template
|
|
||||||
version: a0175ee3bccc567396460bf5acd36800cb10c49c
|
|
||||||
subpackages:
|
|
||||||
- parse
|
|
||||||
- name: github.com/alecthomas/units
|
|
||||||
version: 2efee857e7cfd4f3d0138cc3cbb1b4966962b93a
|
|
||||||
- name: github.com/cheekybits/genny
|
|
||||||
version: 9127e812e1e9e501ce899a18121d316ecb52e4ba
|
|
||||||
subpackages:
|
|
||||||
- generic
|
|
||||||
- name: github.com/coryb/figtree
|
|
||||||
version: 48d3afc6118a0c353dc7d41ff77a3e0b75e14c07
|
|
||||||
- name: github.com/coryb/kingpeon
|
|
||||||
version: 3ca9749293339b932167921f92ce7a55207ad34e
|
|
||||||
- name: github.com/coryb/oreo
|
|
||||||
version: 95687d61c95ee1522c1140e2af59b0c1846abfc1
|
|
||||||
- name: github.com/fatih/camelcase
|
|
||||||
version: f6a740d52f961c60348ebb109adde9f4635d7540
|
|
||||||
- name: github.com/guelfey/go.dbus
|
|
||||||
version: f6a3a2366cc39b8479cadc499d3c735fb10fbdda
|
|
||||||
- name: github.com/jinzhu/copier
|
|
||||||
version: 32e0d0db1dcd4373fb9eb0f9d727b1fe1a723e54
|
|
||||||
- name: github.com/kballard/go-shellquote
|
|
||||||
version: cd60e84ee657ff3dc51de0b4f55dd299a3e136f2
|
|
||||||
- name: github.com/mattn/go-colorable
|
|
||||||
version: ad5389df28cdac544c99bd7b9161a0b5b6ca9d1b
|
|
||||||
- name: github.com/mattn/go-isatty
|
|
||||||
version: fc9e8d8ef48496124e79ae0df75490096eccf6fe
|
|
||||||
- name: github.com/mgutz/ansi
|
|
||||||
version: 9520e82c474b0a04dd04f8a40959027271bab992
|
|
||||||
- name: github.com/pkg/browser
|
|
||||||
version: c90ca0c84f15f81c982e32665bffd8d7aac8f097
|
|
||||||
- name: github.com/pkg/errors
|
|
||||||
version: 645ef00459ed84a119197bfb8d8205042c6df63d
|
|
||||||
- name: github.com/sethgrid/pester
|
|
||||||
version: a86a2d88f4dc3c7dbf3a6a6bbbfb095690b834b6
|
|
||||||
- name: github.com/theckman/go-flock
|
|
||||||
version: 6de226b0d5f040ed85b88c82c381709b98277f3d
|
|
||||||
- name: github.com/tmc/keyring
|
|
||||||
version: 06e6283d50adc5f8fcdb3cdf33ee1244d4400ae1
|
|
||||||
- name: golang.org/x/crypto
|
|
||||||
version: 81e90905daefcd6fd217b62423c0908922eadb30
|
|
||||||
subpackages:
|
|
||||||
- ssh/terminal
|
|
||||||
- name: golang.org/x/sys
|
|
||||||
version: 9aade4d3a3b7e6d876cd3823ad20ec45fc035402
|
|
||||||
subpackages:
|
|
||||||
- unix
|
|
||||||
- windows
|
|
||||||
- name: gopkg.in/AlecAivazis/survey.v1
|
|
||||||
version: 9d910423e24aa6d7c7950160658c295e0734c7e0
|
|
||||||
subpackages:
|
|
||||||
- core
|
|
||||||
- terminal
|
|
||||||
- name: gopkg.in/alecthomas/kingpin.v2
|
|
||||||
version: 1087e65c9441605df944fb12c33f0fe7072d18ca
|
|
||||||
- name: gopkg.in/coryb/yaml.v2
|
|
||||||
version: fb7cb9628c6e3bdd76c29fb91798d51a09832470
|
|
||||||
- name: gopkg.in/op/go-logging.v1
|
|
||||||
version: b2cb9fa56473e98db8caba80237377e83fe44db5
|
|
||||||
testImports: []
|
|
||||||
-22
@@ -1,22 +0,0 @@
|
|||||||
package: gopkg.in/Netflix-Skunkworks/go-jira.v1
|
|
||||||
import:
|
|
||||||
- package: github.com/coryb/figtree
|
|
||||||
- package: github.com/coryb/kingpeon
|
|
||||||
- package: github.com/coryb/oreo
|
|
||||||
- package: github.com/jinzhu/copier
|
|
||||||
- package: github.com/kballard/go-shellquote
|
|
||||||
- package: github.com/mgutz/ansi
|
|
||||||
- package: github.com/pkg/browser
|
|
||||||
- package: github.com/pkg/errors
|
|
||||||
version: ^0.8.0
|
|
||||||
- package: github.com/tmc/keyring
|
|
||||||
- package: golang.org/x/crypto
|
|
||||||
subpackages:
|
|
||||||
- ssh/terminal
|
|
||||||
- package: gopkg.in/AlecAivazis/survey.v1
|
|
||||||
version: ^1.3.1
|
|
||||||
- package: gopkg.in/alecthomas/kingpin.v2
|
|
||||||
version: ^2.2.5
|
|
||||||
- package: gopkg.in/coryb/yaml.v2
|
|
||||||
- package: gopkg.in/op/go-logging.v1
|
|
||||||
version: ^1.0.0
|
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
module github.com/go-jira/jira
|
||||||
|
|
||||||
|
go 1.12
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/Masterminds/goutils v1.1.0 // indirect
|
||||||
|
github.com/Masterminds/semver v1.5.0 // indirect
|
||||||
|
github.com/Masterminds/sprig v2.21.0+incompatible
|
||||||
|
github.com/Netflix/go-expect v0.0.0-20180928190340-9d1f4485533b // indirect
|
||||||
|
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc // indirect
|
||||||
|
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect
|
||||||
|
github.com/cheekybits/genny v1.0.0 // indirect
|
||||||
|
github.com/coryb/figtree v1.0.1-0.20190907170512-58176d03ef0d
|
||||||
|
github.com/coryb/kingpeon v0.0.0-20180107011214-9a669f143f2e
|
||||||
|
github.com/coryb/oreo v0.0.0-20180804211640-3e1b88fc08f1
|
||||||
|
github.com/davecgh/go-spew v1.1.0 // indirect
|
||||||
|
github.com/fatih/camelcase v1.0.0 // indirect
|
||||||
|
github.com/google/go-cmp v0.5.2
|
||||||
|
github.com/google/uuid v1.1.1 // indirect
|
||||||
|
github.com/guelfey/go.dbus v0.0.0-20131113121618-f6a3a2366cc3 // indirect
|
||||||
|
github.com/hinshun/vt10x v0.0.0-20180809195222-d55458df857c // indirect
|
||||||
|
github.com/huandu/xstrings v1.2.0 // indirect
|
||||||
|
github.com/imdario/mergo v0.3.7 // indirect
|
||||||
|
github.com/jinzhu/copier v0.0.0-20180308034124-7e38e58719c3
|
||||||
|
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
|
||||||
|
github.com/kr/pretty v0.1.0 // indirect
|
||||||
|
github.com/kr/pty v1.1.4 // indirect
|
||||||
|
github.com/mattn/go-colorable v0.0.9 // indirect
|
||||||
|
github.com/mattn/go-isatty v0.0.3 // indirect
|
||||||
|
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b
|
||||||
|
github.com/mitchellh/go-wordwrap v1.0.1
|
||||||
|
github.com/olekukonko/tablewriter v0.0.3
|
||||||
|
github.com/pkg/browser v0.0.0-20170505125900-c90ca0c84f15
|
||||||
|
github.com/pkg/errors v0.8.0
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
|
github.com/stretchr/testify v1.2.2
|
||||||
|
github.com/theckman/go-flock v0.4.0 // indirect
|
||||||
|
github.com/tidwall/gjson v0.0.0-20180711011033-ba784d767ac7
|
||||||
|
github.com/tidwall/match v1.0.0 // indirect
|
||||||
|
github.com/tmc/keyring v0.0.0-20171121202319-839169085ae1
|
||||||
|
golang.org/x/crypto v0.0.0-20180723164146-c126467f60eb
|
||||||
|
golang.org/x/net v0.0.0-20171102191033-01c190206fbd
|
||||||
|
golang.org/x/sys v0.0.0-20180727230415-bd9dbc187b6e // indirect
|
||||||
|
gopkg.in/AlecAivazis/survey.v1 v1.6.1
|
||||||
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6
|
||||||
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
|
||||||
|
gopkg.in/coryb/yaml.v2 v2.0.0-20180616071044-0e40e46f7153
|
||||||
|
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473
|
||||||
|
gopkg.in/yaml.v2 v2.2.2 // indirect
|
||||||
|
)
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
github.com/Masterminds/goutils v1.1.0 h1:zukEsf/1JZwCMgHiK3GZftabmxiCw4apj3a28RPBiVg=
|
||||||
|
github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
|
||||||
|
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
|
||||||
|
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
|
||||||
|
github.com/Masterminds/sprig v2.21.0+incompatible h1:nPETddHHEG1ucL7H5t5T95IuWaDe5qB9ImEaztiXgRc=
|
||||||
|
github.com/Masterminds/sprig v2.21.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=
|
||||||
|
github.com/Netflix/go-expect v0.0.0-20180928190340-9d1f4485533b h1:sSQK05nvxs4UkgCJaxihteu+r+6ela3dNMm7NVmsS3c=
|
||||||
|
github.com/Netflix/go-expect v0.0.0-20180928190340-9d1f4485533b/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc=
|
||||||
|
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU=
|
||||||
|
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||||
|
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY=
|
||||||
|
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||||
|
github.com/cheekybits/genny v1.0.0 h1:uGGa4nei+j20rOSeDeP5Of12XVm7TGUd4dJA9RDitfE=
|
||||||
|
github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ=
|
||||||
|
github.com/coryb/figtree v1.0.1-0.20190907170512-58176d03ef0d h1:99xxg8FYj+5TYg88DxA4xL8ODuI6OvuSu35WQOVPDPg=
|
||||||
|
github.com/coryb/figtree v1.0.1-0.20190907170512-58176d03ef0d/go.mod h1:uAkZUEGm6dROpxfy+8vXLs7JrLCI4O+gQyKAuISxI/g=
|
||||||
|
github.com/coryb/kingpeon v0.0.0-20180107011214-9a669f143f2e h1:tGmk9Tuyz7fKuBq/d3nFJvVWRvc48MEBKQC4uYV3wb0=
|
||||||
|
github.com/coryb/kingpeon v0.0.0-20180107011214-9a669f143f2e/go.mod h1:gBc0uEH6swbOMoR7VkVuW7w5fGvZu/KHeSgxBR4Ta7Q=
|
||||||
|
github.com/coryb/oreo v0.0.0-20180804211640-3e1b88fc08f1 h1:Hh0qSvmvoAGL8VxvEoUv9UuUf9XlKcQtSxAMTz1kqfE=
|
||||||
|
github.com/coryb/oreo v0.0.0-20180804211640-3e1b88fc08f1/go.mod h1:l/wuS2rM8ostk0aApWje8tsZNWJPOc2TVr85B0n3e6M=
|
||||||
|
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/fatih/camelcase v1.0.0 h1:hxNvNX/xYBp0ovncs8WyWZrOrpBNub/JfaMvbURyft8=
|
||||||
|
github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc=
|
||||||
|
github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
|
||||||
|
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
|
||||||
|
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
github.com/guelfey/go.dbus v0.0.0-20131113121618-f6a3a2366cc3 h1:fngCxKbvZdctIsWj2hYijhAt4iK0JXSSA78B36xP0yI=
|
||||||
|
github.com/guelfey/go.dbus v0.0.0-20131113121618-f6a3a2366cc3/go.mod h1:0CNX5Cvi77WEH8llpfZ/ieuqyceb1cnO5//b5zzsnF8=
|
||||||
|
github.com/hinshun/vt10x v0.0.0-20180809195222-d55458df857c h1:kp3AxgXgDOmIJFR7bIwqFhwJ2qWar8tEQSE5XXhCfVk=
|
||||||
|
github.com/hinshun/vt10x v0.0.0-20180809195222-d55458df857c/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A=
|
||||||
|
github.com/huandu/xstrings v1.2.0 h1:yPeWdRnmynF7p+lLYz0H2tthW9lqhMJrQV/U7yy4wX0=
|
||||||
|
github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4=
|
||||||
|
github.com/imdario/mergo v0.3.7 h1:Y+UAYTZ7gDEuOfhxKWy+dvb5dRQ6rJjFSdX2HZY1/gI=
|
||||||
|
github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||||
|
github.com/jinzhu/copier v0.0.0-20180308034124-7e38e58719c3 h1:sHsPfNMAG70QAvKbddQ0uScZCHQoZsT5NykGRCeeeIs=
|
||||||
|
github.com/jinzhu/copier v0.0.0-20180308034124-7e38e58719c3/go.mod h1:yL958EeXv8Ylng6IfnvG4oflryUi3vgA3xPs9hmII1s=
|
||||||
|
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
|
||||||
|
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
|
||||||
|
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||||
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
|
github.com/kr/pty v1.1.4 h1:5Myjjh3JY/NaAi4IsUbHADytDyl1VE1Y9PXDlL+P/VQ=
|
||||||
|
github.com/kr/pty v1.1.4/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
|
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||||
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
|
github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=
|
||||||
|
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||||
|
github.com/mattn/go-isatty v0.0.3 h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI=
|
||||||
|
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||||
|
github.com/mattn/go-runewidth v0.0.6 h1:V2iyH+aX9C5fsYCpK60U8BYIvmhqxuOL3JZcqc1NB7k=
|
||||||
|
github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||||
|
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4=
|
||||||
|
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
|
||||||
|
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
|
||||||
|
github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
|
||||||
|
github.com/olekukonko/tablewriter v0.0.3 h1:i0LBnzgiChAWHJYTQAZJDOgf8MNxAVYZJ2m63SIDimI=
|
||||||
|
github.com/olekukonko/tablewriter v0.0.3/go.mod h1:YZeBtGzYYEsCHp2LST/u/0NDwGkRoBtmn1cIWCJiS6M=
|
||||||
|
github.com/pkg/browser v0.0.0-20170505125900-c90ca0c84f15 h1:mrI+6Ae64Wjt+uahGe5we/sPS1sXjvfT3YjtawAVgps=
|
||||||
|
github.com/pkg/browser v0.0.0-20170505125900-c90ca0c84f15/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA=
|
||||||
|
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
|
||||||
|
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||||
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
|
github.com/theckman/go-flock v0.4.0 h1:bcqNkS4RTQBGWybG7IBimUMxnLz53Qes1+D4QaOhzJc=
|
||||||
|
github.com/theckman/go-flock v0.4.0/go.mod h1:kjuth3y9VJ2aNlkNEO99G/8lp9fMIKaGyBmh84IBheM=
|
||||||
|
github.com/tidwall/gjson v0.0.0-20180711011033-ba784d767ac7 h1:PW7TzL8BOpYMcUYSv4qWDoH1Y5iRzVABteynvfF7pwE=
|
||||||
|
github.com/tidwall/gjson v0.0.0-20180711011033-ba784d767ac7/go.mod h1:c/nTNbUr0E0OrXEhq1pwa8iEgc2DOt4ZZqAt1HtCkPA=
|
||||||
|
github.com/tidwall/match v1.0.0 h1:Ym1EcFkp+UQ4ptxfWlW+iMdq5cPH5nEuGzdf/Pb7VmI=
|
||||||
|
github.com/tidwall/match v1.0.0/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E=
|
||||||
|
github.com/tmc/keyring v0.0.0-20171121202319-839169085ae1 h1:+gXfyhy0t28Guz+vFztBg45yIquB2bNtiFvbItzJtUc=
|
||||||
|
github.com/tmc/keyring v0.0.0-20171121202319-839169085ae1/go.mod h1:gsa3jftQ3xia55nzIN4lXLYzDcWdxjojdKoz+N0St2Y=
|
||||||
|
golang.org/x/crypto v0.0.0-20180723164146-c126467f60eb h1:Ah9YqXLj6fEgeKqcmBuLCbAsrF3ScD7dJ/bYM0C6tXI=
|
||||||
|
golang.org/x/crypto v0.0.0-20180723164146-c126467f60eb/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
|
golang.org/x/net v0.0.0-20171102191033-01c190206fbd h1:CLQSRrSDQMOMkogMxky7XOkERftMegAnxjT2re4E66M=
|
||||||
|
golang.org/x/net v0.0.0-20171102191033-01c190206fbd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/sys v0.0.0-20180727230415-bd9dbc187b6e h1:3dQ4fR8k5KugjVKO0oqSd1odxuk2yaE2CIfxWP2WarQ=
|
||||||
|
golang.org/x/sys v0.0.0-20180727230415-bd9dbc187b6e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||||
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
gopkg.in/AlecAivazis/survey.v1 v1.6.1 h1:HyWkjKGBpzhNxrpaKRLDqoa4L1f4cMVBNU4bnVmU8Mw=
|
||||||
|
gopkg.in/AlecAivazis/survey.v1 v1.6.1/go.mod h1:2Ehl7OqkBl3Xb8VmC4oFW2bItAhnUfzIjrOzwRxCrOU=
|
||||||
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
|
||||||
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/coryb/yaml.v2 v2.0.0-20180616071044-0e40e46f7153 h1:3KfEubBNUdXqlEXuMz13dXy4cYK2AvuPhp8fKTYuPdU=
|
||||||
|
gopkg.in/coryb/yaml.v2 v2.0.0-20180616071044-0e40e46f7153/go.mod h1:Vth2iKfSejHZ3p6akgWO0iSjuuiu6mNCEgzcYUCnumw=
|
||||||
|
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473 h1:6D+BvnJ/j6e222UW8s2qTSe3wGBtvo0MbVQG/c5k8RE=
|
||||||
|
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473/go.mod h1:N1eN2tsCx0Ydtgjl4cqmbRCsY4/+z4cYDeqwZTk6zog=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
@@ -4,9 +4,14 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"mime/multipart"
|
||||||
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
"github.com/coryb/oreo"
|
||||||
|
|
||||||
|
"github.com/go-jira/jira/jiradata"
|
||||||
)
|
)
|
||||||
|
|
||||||
type IssueQueryProvider interface {
|
type IssueQueryProvider interface {
|
||||||
@@ -54,7 +59,8 @@ func GetIssue(ua HttpClient, endpoint string, issue string, iqg IssueQueryProvid
|
|||||||
if iqg != nil {
|
if iqg != nil {
|
||||||
query = iqg.ProvideIssueQueryString()
|
query = iqg.ProvideIssueQueryString()
|
||||||
}
|
}
|
||||||
uri := fmt.Sprintf("%s/rest/api/2/issue/%s%s", endpoint, issue, query)
|
uri := URLJoin(endpoint, "rest/api/2/issue", issue)
|
||||||
|
uri += query
|
||||||
resp, err := ua.GetJSON(uri)
|
resp, err := ua.GetJSON(uri)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -63,7 +69,7 @@ func GetIssue(ua HttpClient, endpoint string, issue string, iqg IssueQueryProvid
|
|||||||
|
|
||||||
if resp.StatusCode == 200 {
|
if resp.StatusCode == 200 {
|
||||||
results := &jiradata.Issue{}
|
results := &jiradata.Issue{}
|
||||||
return results, readJSON(resp.Body, results)
|
return results, json.NewDecoder(resp.Body).Decode(results)
|
||||||
}
|
}
|
||||||
return nil, responseError(resp)
|
return nil, responseError(resp)
|
||||||
}
|
}
|
||||||
@@ -79,7 +85,8 @@ func GetIssueWorklog(ua HttpClient, endpoint string, issue string) (*jiradata.Wo
|
|||||||
maxResults := 100
|
maxResults := 100
|
||||||
worklogs := jiradata.Worklogs{}
|
worklogs := jiradata.Worklogs{}
|
||||||
for startAt < total {
|
for startAt < total {
|
||||||
uri := fmt.Sprintf("%s/rest/api/2/issue/%s/worklog?startAt=%d&maxResults=%d", endpoint, issue, startAt, maxResults)
|
uri := URLJoin(endpoint, "rest/api/2/issue", issue, "worklog")
|
||||||
|
uri += fmt.Sprintf("?startAt=%d&maxResults=%d", startAt, maxResults)
|
||||||
resp, err := ua.GetJSON(uri)
|
resp, err := ua.GetJSON(uri)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -88,15 +95,13 @@ func GetIssueWorklog(ua HttpClient, endpoint string, issue string) (*jiradata.Wo
|
|||||||
|
|
||||||
if resp.StatusCode == 200 {
|
if resp.StatusCode == 200 {
|
||||||
results := &jiradata.WorklogWithPagination{}
|
results := &jiradata.WorklogWithPagination{}
|
||||||
err := readJSON(resp.Body, results)
|
err := json.NewDecoder(resp.Body).Decode(results)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
startAt = startAt + maxResults
|
startAt = startAt + maxResults
|
||||||
total = results.Total
|
total = results.Total
|
||||||
for _, worklog := range results.Worklogs {
|
worklogs = append(worklogs, results.Worklogs...)
|
||||||
worklogs = append(worklogs, worklog)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return nil, responseError(resp)
|
return nil, responseError(resp)
|
||||||
}
|
}
|
||||||
@@ -104,6 +109,41 @@ func GetIssueWorklog(ua HttpClient, endpoint string, issue string) (*jiradata.Wo
|
|||||||
return &worklogs, nil
|
return &worklogs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (j *Jira) GetIssueComment(issue string) (*jiradata.Comments, error) {
|
||||||
|
return GetIssueComment(j.UA, j.Endpoint, issue)
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://docs.atlassian.com/software/jira/docs/api/REST/7.12.0/#api/2/issue-getComments
|
||||||
|
func GetIssueComment(ua HttpClient, endpoint string, issue string) (*jiradata.Comments, error) {
|
||||||
|
startAt := 0
|
||||||
|
total := 1
|
||||||
|
maxResults := 100
|
||||||
|
comments := jiradata.Comments{}
|
||||||
|
for startAt < total {
|
||||||
|
uri := URLJoin(endpoint, "rest/api/2/issue", issue, "comment")
|
||||||
|
uri += fmt.Sprintf("?startAt=%d&maxResults=%d", startAt, maxResults)
|
||||||
|
resp, err := ua.GetJSON(uri)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
if resp.StatusCode == 200 {
|
||||||
|
results := &jiradata.CommentsWithPagination{}
|
||||||
|
err := json.NewDecoder(resp.Body).Decode(results)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
startAt = startAt + maxResults
|
||||||
|
total = results.Total
|
||||||
|
comments = append(comments, results.Comments...)
|
||||||
|
} else {
|
||||||
|
return nil, responseError(resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return &comments, nil
|
||||||
|
}
|
||||||
|
|
||||||
type WorklogProvider interface {
|
type WorklogProvider interface {
|
||||||
ProvideWorklog() *jiradata.Worklog
|
ProvideWorklog() *jiradata.Worklog
|
||||||
}
|
}
|
||||||
@@ -119,7 +159,7 @@ func AddIssueWorklog(ua HttpClient, endpoint string, issue string, wp WorklogPro
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
uri := fmt.Sprintf("%s/rest/api/2/issue/%s/worklog", endpoint, issue)
|
uri := URLJoin(endpoint, "rest/api/2/issue", issue, "worklog")
|
||||||
resp, err := ua.Post(uri, "application/json", bytes.NewBuffer(encoded))
|
resp, err := ua.Post(uri, "application/json", bytes.NewBuffer(encoded))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -128,7 +168,7 @@ func AddIssueWorklog(ua HttpClient, endpoint string, issue string, wp WorklogPro
|
|||||||
|
|
||||||
if resp.StatusCode == 201 {
|
if resp.StatusCode == 201 {
|
||||||
results := &jiradata.Worklog{}
|
results := &jiradata.Worklog{}
|
||||||
return results, readJSON(resp.Body, results)
|
return results, json.NewDecoder(resp.Body).Decode(results)
|
||||||
}
|
}
|
||||||
return nil, responseError(resp)
|
return nil, responseError(resp)
|
||||||
}
|
}
|
||||||
@@ -139,7 +179,7 @@ func (j *Jira) GetIssueEditMeta(issue string) (*jiradata.EditMeta, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetIssueEditMeta(ua HttpClient, endpoint string, issue string) (*jiradata.EditMeta, error) {
|
func GetIssueEditMeta(ua HttpClient, endpoint string, issue string) (*jiradata.EditMeta, error) {
|
||||||
uri := fmt.Sprintf("%s/rest/api/2/issue/%s/editmeta", endpoint, issue)
|
uri := URLJoin(endpoint, "rest/api/2/issue", issue, "editmeta")
|
||||||
resp, err := ua.GetJSON(uri)
|
resp, err := ua.GetJSON(uri)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -148,7 +188,7 @@ func GetIssueEditMeta(ua HttpClient, endpoint string, issue string) (*jiradata.E
|
|||||||
|
|
||||||
if resp.StatusCode == 200 {
|
if resp.StatusCode == 200 {
|
||||||
results := &jiradata.EditMeta{}
|
results := &jiradata.EditMeta{}
|
||||||
return results, readJSON(resp.Body, results)
|
return results, json.NewDecoder(resp.Body).Decode(results)
|
||||||
}
|
}
|
||||||
return nil, responseError(resp)
|
return nil, responseError(resp)
|
||||||
}
|
}
|
||||||
@@ -168,7 +208,7 @@ func EditIssue(ua HttpClient, endpoint string, issue string, iup IssueUpdateProv
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
uri := fmt.Sprintf("%s/rest/api/2/issue/%s", endpoint, issue)
|
uri := URLJoin(endpoint, "rest/api/2/issue", issue)
|
||||||
resp, err := ua.Put(uri, "application/json", bytes.NewBuffer(encoded))
|
resp, err := ua.Put(uri, "application/json", bytes.NewBuffer(encoded))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -192,7 +232,7 @@ func CreateIssue(ua HttpClient, endpoint string, iup IssueUpdateProvider) (*jira
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
uri := fmt.Sprintf("%s/rest/api/2/issue", endpoint)
|
uri := URLJoin(endpoint, "rest/api/2/issue")
|
||||||
resp, err := ua.Post(uri, "application/json", bytes.NewBuffer(encoded))
|
resp, err := ua.Post(uri, "application/json", bytes.NewBuffer(encoded))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -201,7 +241,7 @@ func CreateIssue(ua HttpClient, endpoint string, iup IssueUpdateProvider) (*jira
|
|||||||
|
|
||||||
if resp.StatusCode == 201 {
|
if resp.StatusCode == 201 {
|
||||||
results := &jiradata.IssueCreateResponse{}
|
results := &jiradata.IssueCreateResponse{}
|
||||||
return results, readJSON(resp.Body, results)
|
return results, json.NewDecoder(resp.Body).Decode(results)
|
||||||
}
|
}
|
||||||
return nil, responseError(resp)
|
return nil, responseError(resp)
|
||||||
}
|
}
|
||||||
@@ -212,7 +252,8 @@ func (j *Jira) GetIssueCreateMetaProject(projectKey string) (*jiradata.CreateMet
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetIssueCreateMetaProject(ua HttpClient, endpoint string, projectKey string) (*jiradata.CreateMetaProject, error) {
|
func GetIssueCreateMetaProject(ua HttpClient, endpoint string, projectKey string) (*jiradata.CreateMetaProject, error) {
|
||||||
uri := fmt.Sprintf("%s/rest/api/2/issue/createmeta?projectKeys=%s&expand=projects.issuetypes.fields", endpoint, projectKey)
|
uri := URLJoin(endpoint, "rest/api/2/issue/createmeta")
|
||||||
|
uri += fmt.Sprintf("?projectKeys=%s&expand=projects.issuetypes.fields", projectKey)
|
||||||
resp, err := ua.GetJSON(uri)
|
resp, err := ua.GetJSON(uri)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -221,7 +262,7 @@ func GetIssueCreateMetaProject(ua HttpClient, endpoint string, projectKey string
|
|||||||
|
|
||||||
if resp.StatusCode == 200 {
|
if resp.StatusCode == 200 {
|
||||||
results := &jiradata.CreateMeta{}
|
results := &jiradata.CreateMeta{}
|
||||||
err = readJSON(resp.Body, results)
|
err = json.NewDecoder(resp.Body).Decode(results)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -230,7 +271,7 @@ func GetIssueCreateMetaProject(ua HttpClient, endpoint string, projectKey string
|
|||||||
return project, nil
|
return project, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("Project %s not found", projectKey)
|
return nil, fmt.Errorf("project %s not found", projectKey)
|
||||||
}
|
}
|
||||||
return nil, responseError(resp)
|
return nil, responseError(resp)
|
||||||
}
|
}
|
||||||
@@ -241,31 +282,32 @@ func (j *Jira) GetIssueCreateMetaIssueType(projectKey, issueTypeName string) (*j
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetIssueCreateMetaIssueType(ua HttpClient, endpoint string, projectKey, issueTypeName string) (*jiradata.IssueType, error) {
|
func GetIssueCreateMetaIssueType(ua HttpClient, endpoint string, projectKey, issueTypeName string) (*jiradata.IssueType, error) {
|
||||||
uri := fmt.Sprintf("%s/rest/api/2/issue/createmeta?projectKeys=%s&issuetypeNames=%s&expand=projects.issuetypes.fields", endpoint, projectKey, issueTypeName)
|
uri := URLJoin(endpoint, "rest/api/2/issue/createmeta")
|
||||||
|
uri += fmt.Sprintf("?projectKeys=%s&issuetypeNames=%s&expand=projects.issuetypes.fields", projectKey, url.QueryEscape(issueTypeName))
|
||||||
resp, err := ua.GetJSON(uri)
|
resp, err := ua.GetJSON(uri)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
if resp.StatusCode == 200 {
|
if resp.StatusCode != 200 {
|
||||||
results := &jiradata.CreateMeta{}
|
return nil, responseError(resp)
|
||||||
err = readJSON(resp.Body, results)
|
}
|
||||||
if err != nil {
|
results := &jiradata.CreateMeta{}
|
||||||
return nil, err
|
if err := json.NewDecoder(resp.Body).Decode(results); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
for _, project := range results.Projects {
|
||||||
|
if project.Key != projectKey {
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
for _, project := range results.Projects {
|
for _, issueType := range project.IssueTypes {
|
||||||
if project.Key == projectKey {
|
if issueType.Name == issueTypeName {
|
||||||
for _, issueType := range project.IssueTypes {
|
return issueType, nil
|
||||||
if issueType.Name == issueTypeName {
|
|
||||||
return issueType, nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("Project %s and IssueType %s not found", projectKey, issueTypeName)
|
|
||||||
}
|
}
|
||||||
return nil, responseError(resp)
|
return nil, fmt.Errorf("project %s and IssueType %s not found", projectKey, issueTypeName)
|
||||||
}
|
}
|
||||||
|
|
||||||
type LinkIssueProvider interface {
|
type LinkIssueProvider interface {
|
||||||
@@ -283,7 +325,7 @@ func LinkIssues(ua HttpClient, endpoint string, lip LinkIssueProvider) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
uri := fmt.Sprintf("%s/rest/api/2/issueLink", endpoint)
|
uri := URLJoin(endpoint, "rest/api/2/issueLink")
|
||||||
resp, err := ua.Post(uri, "application/json", bytes.NewBuffer(encoded))
|
resp, err := ua.Post(uri, "application/json", bytes.NewBuffer(encoded))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -302,7 +344,8 @@ func (j *Jira) GetIssueTransitions(issue string) (*jiradata.TransitionsMeta, err
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetIssueTransitions(ua HttpClient, endpoint string, issue string) (*jiradata.TransitionsMeta, error) {
|
func GetIssueTransitions(ua HttpClient, endpoint string, issue string) (*jiradata.TransitionsMeta, error) {
|
||||||
uri := fmt.Sprintf("%s/rest/api/2/issue/%s/transitions?expand=transitions.fields", endpoint, issue)
|
uri := URLJoin(endpoint, "rest/api/2/issue", issue, "transitions")
|
||||||
|
uri += "?expand=transitions.fields"
|
||||||
resp, err := ua.GetJSON(uri)
|
resp, err := ua.GetJSON(uri)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -311,7 +354,7 @@ func GetIssueTransitions(ua HttpClient, endpoint string, issue string) (*jiradat
|
|||||||
|
|
||||||
if resp.StatusCode == 200 {
|
if resp.StatusCode == 200 {
|
||||||
results := &jiradata.TransitionsMeta{}
|
results := &jiradata.TransitionsMeta{}
|
||||||
return results, readJSON(resp.Body, results)
|
return results, json.NewDecoder(resp.Body).Decode(results)
|
||||||
}
|
}
|
||||||
return nil, responseError(resp)
|
return nil, responseError(resp)
|
||||||
}
|
}
|
||||||
@@ -327,7 +370,7 @@ func TransitionIssue(ua HttpClient, endpoint string, issue string, iup IssueUpda
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
uri := fmt.Sprintf("%s/rest/api/2/issue/%s/transitions", endpoint, issue)
|
uri := URLJoin(endpoint, "rest/api/2/issue", issue, "transitions")
|
||||||
resp, err := ua.Post(uri, "application/json", bytes.NewBuffer(encoded))
|
resp, err := ua.Post(uri, "application/json", bytes.NewBuffer(encoded))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -346,7 +389,7 @@ func (j *Jira) GetIssueLinkTypes() (*jiradata.IssueLinkTypes, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetIssueLinkTypes(ua HttpClient, endpoint string) (*jiradata.IssueLinkTypes, error) {
|
func GetIssueLinkTypes(ua HttpClient, endpoint string) (*jiradata.IssueLinkTypes, error) {
|
||||||
uri := fmt.Sprintf("%s/rest/api/2/issueLinkType", endpoint)
|
uri := URLJoin(endpoint, "rest/api/2/issueLinkType")
|
||||||
resp, err := ua.GetJSON(uri)
|
resp, err := ua.GetJSON(uri)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -359,7 +402,7 @@ func GetIssueLinkTypes(ua HttpClient, endpoint string) (*jiradata.IssueLinkTypes
|
|||||||
}{
|
}{
|
||||||
IssueLinkTypes: jiradata.IssueLinkTypes{},
|
IssueLinkTypes: jiradata.IssueLinkTypes{},
|
||||||
}
|
}
|
||||||
return &results.IssueLinkTypes, readJSON(resp.Body, &results)
|
return &results.IssueLinkTypes, json.NewDecoder(resp.Body).Decode(&results)
|
||||||
}
|
}
|
||||||
return nil, responseError(resp)
|
return nil, responseError(resp)
|
||||||
}
|
}
|
||||||
@@ -370,7 +413,7 @@ func (j *Jira) IssueAddVote(issue string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func IssueAddVote(ua HttpClient, endpoint string, issue string) error {
|
func IssueAddVote(ua HttpClient, endpoint string, issue string) error {
|
||||||
uri := fmt.Sprintf("%s/rest/api/2/issue/%s/votes", endpoint, issue)
|
uri := URLJoin(endpoint, "rest/api/2/issue", issue, "votes")
|
||||||
resp, err := ua.Post(uri, "application/json", strings.NewReader("{}"))
|
resp, err := ua.Post(uri, "application/json", strings.NewReader("{}"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -389,7 +432,7 @@ func (j *Jira) IssueRemoveVote(issue string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func IssueRemoveVote(ua HttpClient, endpoint string, issue string) error {
|
func IssueRemoveVote(ua HttpClient, endpoint string, issue string) error {
|
||||||
uri := fmt.Sprintf("%s/rest/api/2/issue/%s/votes", endpoint, issue)
|
uri := URLJoin(endpoint, "rest/api/2/issue", issue, "votes")
|
||||||
resp, err := ua.Delete(uri)
|
resp, err := ua.Delete(uri)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -417,7 +460,7 @@ func RankIssues(ua HttpClient, endpoint string, rrp RankRequestProvider) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
uri := fmt.Sprintf("%s/rest/agile/1.0/issue/rank", endpoint)
|
uri := URLJoin(endpoint, "rest/agile/1.0/issue/rank")
|
||||||
resp, err := ua.Put(uri, "application/json", bytes.NewBuffer(encoded))
|
resp, err := ua.Put(uri, "application/json", bytes.NewBuffer(encoded))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -436,7 +479,7 @@ func (j *Jira) IssueAddWatcher(issue, user string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func IssueAddWatcher(ua HttpClient, endpoint string, issue, user string) error {
|
func IssueAddWatcher(ua HttpClient, endpoint string, issue, user string) error {
|
||||||
uri := fmt.Sprintf("%s/rest/api/2/issue/%s/watchers", endpoint, issue)
|
uri := URLJoin(endpoint, "rest/api/2/issue", issue, "watchers")
|
||||||
resp, err := ua.Post(uri, "application/json", strings.NewReader(fmt.Sprintf("%q", user)))
|
resp, err := ua.Post(uri, "application/json", strings.NewReader(fmt.Sprintf("%q", user)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -455,7 +498,8 @@ func (j *Jira) IssueRemoveWatcher(issue, user string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func IssueRemoveWatcher(ua HttpClient, endpoint string, issue, user string) error {
|
func IssueRemoveWatcher(ua HttpClient, endpoint string, issue, user string) error {
|
||||||
uri := fmt.Sprintf("%s/rest/api/2/issue/%s/watchers?username=%s", endpoint, issue, user)
|
uri := URLJoin(endpoint, "rest/api/2/issue", issue, "watchers")
|
||||||
|
uri += fmt.Sprintf("?accountId=%s", user)
|
||||||
resp, err := ua.Delete(uri)
|
resp, err := ua.Delete(uri)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -483,7 +527,7 @@ func IssueAddComment(ua HttpClient, endpoint string, issue string, cp CommentPro
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
uri := fmt.Sprintf("%s/rest/api/2/issue/%s/comment", endpoint, issue)
|
uri := URLJoin(endpoint, "rest/api/2/issue", issue, "comment")
|
||||||
resp, err := ua.Post(uri, "application/json", bytes.NewBuffer(encoded))
|
resp, err := ua.Post(uri, "application/json", bytes.NewBuffer(encoded))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -492,7 +536,7 @@ func IssueAddComment(ua HttpClient, endpoint string, issue string, cp CommentPro
|
|||||||
|
|
||||||
if resp.StatusCode == 201 {
|
if resp.StatusCode == 201 {
|
||||||
results := jiradata.Comment{}
|
results := jiradata.Comment{}
|
||||||
return &results, readJSON(resp.Body, &results)
|
return &results, json.NewDecoder(resp.Body).Decode(&results)
|
||||||
}
|
}
|
||||||
return nil, responseError(resp)
|
return nil, responseError(resp)
|
||||||
}
|
}
|
||||||
@@ -521,7 +565,7 @@ func IssueAssign(ua HttpClient, endpoint string, issue, name string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
uri := fmt.Sprintf("%s/rest/api/2/issue/%s/assignee", endpoint, issue)
|
uri := URLJoin(endpoint, "rest/api/2/issue", issue, "assignee")
|
||||||
resp, err := ua.Put(uri, "application/json", bytes.NewBuffer(encoded))
|
resp, err := ua.Put(uri, "application/json", bytes.NewBuffer(encoded))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -533,3 +577,72 @@ func IssueAssign(ua HttpClient, endpoint string, issue, name string) error {
|
|||||||
}
|
}
|
||||||
return responseError(resp)
|
return responseError(resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IssueAssignAccountID(ua HttpClient, endpoint string, issue, acctId string) error {
|
||||||
|
// this is special, not using the jiradata.User structure
|
||||||
|
// because we need to be able to send `null` as the name param
|
||||||
|
// when we want to un-assign the issue
|
||||||
|
req := struct {
|
||||||
|
AccountID *string `json:"accountId"`
|
||||||
|
}{&acctId}
|
||||||
|
if acctId == "" {
|
||||||
|
req.AccountID = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
encoded, err := json.Marshal(req)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
uri := URLJoin(endpoint, "rest/api/2/issue", issue, "assignee")
|
||||||
|
resp, err := ua.Put(uri, "application/json", bytes.NewBuffer(encoded))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
if resp.StatusCode == 204 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return responseError(resp)
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://docs.atlassian.com/jira/REST/cloud/#api/2/issue/{issueIdOrKey}/attachments-addAttachment
|
||||||
|
func (j *Jira) IssueAttachFile(issue, filename string, contents io.Reader) (*jiradata.ListOfAttachment, error) {
|
||||||
|
return IssueAttachFile(j.UA, j.Endpoint, issue, filename, contents)
|
||||||
|
}
|
||||||
|
|
||||||
|
func IssueAttachFile(ua HttpClient, endpoint string, issue, filename string, contents io.Reader) (*jiradata.ListOfAttachment, error) {
|
||||||
|
var buf bytes.Buffer
|
||||||
|
w := multipart.NewWriter(&buf)
|
||||||
|
formFile, err := w.CreateFormFile("file", filename)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
_, err = io.Copy(formFile, contents)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
uri, err := url.Parse(URLJoin(endpoint, "rest/api/2/issue", issue, "attachments"))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
req := oreo.RequestBuilder(uri).WithMethod("POST").WithHeader(
|
||||||
|
"X-Atlassian-Token", "no-check",
|
||||||
|
).WithHeader(
|
||||||
|
"Accept", "application/json",
|
||||||
|
).WithContentType(w.FormDataContentType()).WithBody(&buf).Build()
|
||||||
|
w.Close()
|
||||||
|
|
||||||
|
resp, err := ua.Do(req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
if resp.StatusCode == 200 {
|
||||||
|
results := jiradata.ListOfAttachment{}
|
||||||
|
return &results, json.NewDecoder(resp.Body).Decode(&results)
|
||||||
|
}
|
||||||
|
return nil, responseError(resp)
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,12 +2,10 @@ package jira
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
logging "gopkg.in/op/go-logging.v1"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var log = logging.MustGetLogger("jira")
|
// replace by ldflags
|
||||||
|
var VERSION = "development"
|
||||||
const VERSION = "1.0.1"
|
|
||||||
|
|
||||||
type Jira struct {
|
type Jira struct {
|
||||||
Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
|
Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
|
||||||
|
|||||||
+328
-75
@@ -3,6 +3,7 @@ package jiracli
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
@@ -10,36 +11,114 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"runtime/debug"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/coryb/figtree"
|
"github.com/coryb/figtree"
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
"github.com/jinzhu/copier"
|
"github.com/jinzhu/copier"
|
||||||
shellquote "github.com/kballard/go-shellquote"
|
shellquote "github.com/kballard/go-shellquote"
|
||||||
|
"github.com/tidwall/gjson"
|
||||||
"gopkg.in/AlecAivazis/survey.v1"
|
"gopkg.in/AlecAivazis/survey.v1"
|
||||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||||
yaml "gopkg.in/coryb/yaml.v2"
|
yaml "gopkg.in/coryb/yaml.v2"
|
||||||
logging "gopkg.in/op/go-logging.v1"
|
logging "gopkg.in/op/go-logging.v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var log = logging.MustGetLogger("jira")
|
|
||||||
|
|
||||||
type Exit struct {
|
type Exit struct {
|
||||||
Code int
|
Code int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HandleExit will unwind any panics and check to see if they are jiracli.Exit
|
||||||
|
// and exit accordingly.
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
// func main() {
|
||||||
|
// defer jiracli.HandleExit()
|
||||||
|
// ...
|
||||||
|
// }
|
||||||
|
func HandleExit() {
|
||||||
|
if e := recover(); e != nil {
|
||||||
|
if exit, ok := e.(Exit); ok {
|
||||||
|
os.Exit(exit.Code)
|
||||||
|
} else {
|
||||||
|
fmt.Fprintf(os.Stderr, "%s\n%s", e, debug.Stack())
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
ServerDeploymentType = "server"
|
||||||
|
CloudDeploymentType = "cloud"
|
||||||
|
)
|
||||||
|
|
||||||
type GlobalOptions struct {
|
type GlobalOptions struct {
|
||||||
Endpoint figtree.StringOption `yaml:"endpoint,omitempty" json:"endpoint,omitempty"`
|
// AuthenticationMethod is the method we use to authenticate with the jira serivce.
|
||||||
Insecure figtree.BoolOption `yaml:"insecure,omitempty" json:"insecure,omitempty"`
|
// Possible values are "api-token", "bearer-token" or "session".
|
||||||
|
// The default is "api-token" when the service endpoint ends with "atlassian.net", otherwise it "session". Session authentication
|
||||||
|
// will promt for user password and use the /auth/1/session-login endpoint.
|
||||||
|
AuthenticationMethod figtree.StringOption `yaml:"authentication-method,omitempty" json:"authentication-method,omitempty"`
|
||||||
|
|
||||||
|
// Endpoint is the URL for the Jira service. Something like: https://go-jira.atlassian.net
|
||||||
|
Endpoint figtree.StringOption `yaml:"endpoint,omitempty" json:"endpoint,omitempty"`
|
||||||
|
|
||||||
|
// Insecure will allow you to connect to an https endpoint with a self-signed SSL certificate
|
||||||
|
Insecure figtree.BoolOption `yaml:"insecure,omitempty" json:"insecure,omitempty"`
|
||||||
|
|
||||||
|
// Login is the id used for authenticating with the Jira service. For "api-token" AuthenticationMethod this is usually a
|
||||||
|
// full email address, something like "user@example.com". For "session" AuthenticationMethod this will be something
|
||||||
|
// like "user", which by default will use the same value in the `User` field.
|
||||||
|
Login figtree.StringOption `yaml:"login,omitempty" json:"login,omitempty"`
|
||||||
|
|
||||||
|
// PasswordSource specificies the method that we fetch the password. Possible values are "keyring" or "pass".
|
||||||
|
// If this is unset we will just prompt the user. For "keyring" this will look in the OS keychain, if missing
|
||||||
|
// then prompt the user and store the password in the OS keychain. For "pass" this will look 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"`
|
||||||
Quiet figtree.BoolOption `yaml:"quiet,omitempty" json:"quiet,omitempty"`
|
|
||||||
UnixProxy figtree.StringOption `yaml:"unixproxy,omitempty" json:"unixproxy,omitempty"`
|
// PasswordSourcePath can be used to specify the path to the PasswordSource binary to use.
|
||||||
User figtree.StringOption `yaml:"user,omitempty" json:"user,omitempty"`
|
PasswordSourcePath figtree.StringOption `yaml:"password-source-path,omitempty" json:"password-source-path,omitempty"`
|
||||||
|
|
||||||
|
// Cached password to avoid invoking password source on each API request
|
||||||
|
cachedPassword string
|
||||||
|
|
||||||
|
// PasswordDirectory is only used for the "pass" PasswordSource. It is the location for the encrypted password
|
||||||
|
// files used by `pass`. Effectively this overrides the "PASSWORD_STORE_DIR" environment variable
|
||||||
|
PasswordDirectory figtree.StringOption `yaml:"password-directory,omitempty" json:"password-directory,omitempty"`
|
||||||
|
|
||||||
|
// PasswordName is the the name of the password key entry stored used with PasswordSource `pass`.
|
||||||
|
PasswordName figtree.StringOption `yaml:"password-name,omitempty" json:"password-name,omitempty"`
|
||||||
|
|
||||||
|
// Quiet will lower the defalt log level to suppress the standard output for commands
|
||||||
|
Quiet figtree.BoolOption `yaml:"quiet,omitempty" json:"quiet,omitempty"`
|
||||||
|
|
||||||
|
// SocksProxy is used to configure the http client to access the Endpoint via a socks proxy. The value
|
||||||
|
// should be a ip address and port string, something like "127.0.0.1:1080"
|
||||||
|
SocksProxy figtree.StringOption `yaml:"socksproxy,omitempty" json:"socksproxy,omitempty"`
|
||||||
|
|
||||||
|
// UnixProxy is use to configure the http client to access the Endpoint via a local unix domain socket used
|
||||||
|
// to proxy requests
|
||||||
|
UnixProxy figtree.StringOption `yaml:"unixproxy,omitempty" json:"unixproxy,omitempty"`
|
||||||
|
|
||||||
|
// User is use to represent the user on the Jira service. This can be different from the username used to
|
||||||
|
// authenticate with the service. For example when using AuthenticationMethod `api-token` the Login is
|
||||||
|
// typically an email address like `username@example.com` and the User property would be someting like
|
||||||
|
// `username` The User property is used on Jira service API calls that require a user to associate with
|
||||||
|
// an Issue (like assigning a Issue to yourself)
|
||||||
|
User figtree.StringOption `yaml:"user,omitempty" json:"user,omitempty"`
|
||||||
|
|
||||||
|
// JiraDeploymentType can be `cloud` or `server`, if not set it will be inferred from
|
||||||
|
// the /rest/api/2/serverInfo REST API.
|
||||||
|
JiraDeploymentType figtree.StringOption `yaml:"jira-deployment-type,omitempty" json:"jira-deployment-type,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CommonOptions struct {
|
type CommonOptions struct {
|
||||||
Browse figtree.BoolOption `yaml:"browse,omitempty" json:"browse,omitempty"`
|
Browse figtree.BoolOption `yaml:"browse,omitempty" json:"browse,omitempty"`
|
||||||
Editor figtree.StringOption `yaml:"editor,omitempty" json:"editor,omitempty"`
|
Editor figtree.StringOption `yaml:"editor,omitempty" json:"editor,omitempty"`
|
||||||
|
File figtree.StringOption `yaml:"file,omitempty" json:"file,omitempty"`
|
||||||
|
GJsonQuery figtree.StringOption `yaml:"gjq,omitempty" json:"gjq,omitempty"`
|
||||||
SkipEditing figtree.BoolOption `yaml:"noedit,omitempty" json:"noedit,omitempty"`
|
SkipEditing figtree.BoolOption `yaml:"noedit,omitempty" json:"noedit,omitempty"`
|
||||||
Template figtree.StringOption `yaml:"template,omitempty" json:"template,omitempty"`
|
Template figtree.StringOption `yaml:"template,omitempty" json:"template,omitempty"`
|
||||||
}
|
}
|
||||||
@@ -63,34 +142,52 @@ type kingpinAppOrCommand interface {
|
|||||||
GetCommand(string) *kingpin.CmdClause
|
GetCommand(string) *kingpin.CmdClause
|
||||||
}
|
}
|
||||||
|
|
||||||
func Register(app *kingpin.Application, o *oreo.Client, fig *figtree.FigTree, reg []CommandRegistry) {
|
var globalCommandRegistry = []CommandRegistry{}
|
||||||
|
|
||||||
|
func RegisterCommand(regEntry CommandRegistry) {
|
||||||
|
globalCommandRegistry = append(globalCommandRegistry, regEntry)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GlobalOptions) AuthMethod() string {
|
||||||
|
if strings.Contains(o.Endpoint.Value, ".atlassian.net") && o.AuthenticationMethod.Source == "default" {
|
||||||
|
return "api-token"
|
||||||
|
}
|
||||||
|
return o.AuthenticationMethod.Value
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GlobalOptions) AuthMethodIsToken() bool{
|
||||||
|
return o.AuthMethod() == "api-token" || o.AuthMethod() == "bearer-token";
|
||||||
|
}
|
||||||
|
|
||||||
|
func register(app *kingpin.Application, o *oreo.Client, fig *figtree.FigTree) {
|
||||||
globals := GlobalOptions{
|
globals := GlobalOptions{
|
||||||
User: figtree.NewStringOption(os.Getenv("USER")),
|
User: figtree.NewStringOption(os.Getenv("USER")),
|
||||||
|
AuthenticationMethod: figtree.NewStringOption("session"),
|
||||||
}
|
}
|
||||||
app.Flag("endpoint", "Base URI to use for Jira").Short('e').SetValue(&globals.Endpoint)
|
app.Flag("endpoint", "Base URI to use for Jira").Short('e').SetValue(&globals.Endpoint)
|
||||||
app.Flag("insecure", "Disable TLS certificate verification").Short('k').SetValue(&globals.Insecure)
|
app.Flag("insecure", "Disable TLS certificate verification").Short('k').SetValue(&globals.Insecure)
|
||||||
app.Flag("quiet", "Suppress output to console").Short('Q').SetValue(&globals.Quiet)
|
app.Flag("quiet", "Suppress output to console").Short('Q').SetValue(&globals.Quiet)
|
||||||
app.Flag("unixproxy", "Path for a unix-socket proxy").SetValue(&globals.UnixProxy)
|
app.Flag("unixproxy", "Path for a unix-socket proxy").SetValue(&globals.UnixProxy)
|
||||||
app.Flag("user", "Login name used for authentication with Jira service").Short('u').SetValue(&globals.User)
|
app.Flag("socksproxy", "Address for a socks proxy").SetValue(&globals.SocksProxy)
|
||||||
|
app.Flag("user", "user name used within the Jira service").Short('u').SetValue(&globals.User)
|
||||||
|
app.Flag("login", "login name that corresponds to the user used for authentication").SetValue(&globals.Login)
|
||||||
|
|
||||||
app.PreAction(func(_ *kingpin.ParseContext) error {
|
o = o.WithPreCallback(func(req *http.Request) (*http.Request, error) {
|
||||||
if globals.Insecure.Value {
|
if globals.AuthMethod() == "api-token" {
|
||||||
transport := &http.Transport{
|
// need to set basic auth header with user@domain:api-token
|
||||||
Proxy: http.ProxyFromEnvironment,
|
token := globals.GetPass()
|
||||||
TLSClientConfig: &tls.Config{
|
authHeader := fmt.Sprintf("Basic %s", base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", globals.Login.Value, token))))
|
||||||
InsecureSkipVerify: true,
|
req.Header.Add("Authorization", authHeader)
|
||||||
},
|
} else if globals.AuthMethod() == "bearer-token" {
|
||||||
}
|
token := globals.GetPass()
|
||||||
o = o.WithTransport(transport)
|
authHeader := fmt.Sprintf("Bearer %s", token)
|
||||||
|
req.Header.Add("Authorization", authHeader)
|
||||||
}
|
}
|
||||||
if globals.UnixProxy.Value != "" {
|
return req, nil
|
||||||
o = o.WithTransport(unixProxy(globals.UnixProxy.Value))
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
})
|
||||||
|
|
||||||
o = o.WithPostCallback(
|
o = o.WithPostCallback(func(req *http.Request, resp *http.Response) (*http.Response, error) {
|
||||||
func(req *http.Request, resp *http.Response) (*http.Response, error) {
|
if globals.AuthMethod() == "session" {
|
||||||
authUser := resp.Header.Get("X-Ausername")
|
authUser := resp.Header.Get("X-Ausername")
|
||||||
if authUser == "" || authUser == "anonymous" {
|
if authUser == "" || authUser == "anonymous" {
|
||||||
// preserve the --quiet value, we need to temporarily disable it so
|
// preserve the --quiet value, we need to temporarily disable it so
|
||||||
@@ -106,11 +203,14 @@ func Register(app *kingpin.Application, o *oreo.Client, fig *figtree.FigTree, re
|
|||||||
// rerun the original request
|
// rerun the original request
|
||||||
return o.Do(req)
|
return o.Do(req)
|
||||||
}
|
}
|
||||||
return resp, nil
|
} else if globals.AuthMethodIsToken() && resp.StatusCode == 401 {
|
||||||
},
|
globals.SetPass("")
|
||||||
)
|
return o.Do(req)
|
||||||
|
}
|
||||||
|
return resp, nil
|
||||||
|
})
|
||||||
|
|
||||||
for _, command := range reg {
|
for _, command := range globalCommandRegistry {
|
||||||
copy := command
|
copy := command
|
||||||
commandFields := strings.Fields(copy.Command)
|
commandFields := strings.Fields(copy.Command)
|
||||||
var appOrCmd kingpinAppOrCommand = app
|
var appOrCmd kingpinAppOrCommand = app
|
||||||
@@ -126,6 +226,29 @@ func Register(app *kingpin.Application, o *oreo.Client, fig *figtree.FigTree, re
|
|||||||
|
|
||||||
cmd := appOrCmd.Command(commandFields[len(commandFields)-1], copy.Entry.Help)
|
cmd := appOrCmd.Command(commandFields[len(commandFields)-1], copy.Entry.Help)
|
||||||
LoadConfigs(cmd, fig, &globals)
|
LoadConfigs(cmd, fig, &globals)
|
||||||
|
cmd.PreAction(func(_ *kingpin.ParseContext) error {
|
||||||
|
if globals.Insecure.Value {
|
||||||
|
transport := &http.Transport{
|
||||||
|
Proxy: http.ProxyFromEnvironment,
|
||||||
|
TLSClientConfig: &tls.Config{
|
||||||
|
InsecureSkipVerify: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
o = o.WithTransport(transport)
|
||||||
|
}
|
||||||
|
if globals.UnixProxy.Value != "" {
|
||||||
|
o = o.WithTransport(unixProxy(globals.UnixProxy.Value))
|
||||||
|
} else if globals.SocksProxy.Value != "" {
|
||||||
|
o = o.WithTransport(socksProxy(globals.SocksProxy.Value))
|
||||||
|
}
|
||||||
|
if globals.AuthMethodIsToken() {
|
||||||
|
o = o.WithCookieFile("")
|
||||||
|
}
|
||||||
|
if globals.Login.Value == "" {
|
||||||
|
globals.Login = globals.User
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
for _, alias := range copy.Aliases {
|
for _, alias := range copy.Aliases {
|
||||||
cmd = cmd.Alias(alias)
|
cmd = cmd.Alias(alias)
|
||||||
@@ -137,11 +260,12 @@ func Register(app *kingpin.Application, o *oreo.Client, fig *figtree.FigTree, re
|
|||||||
copy.Entry.UsageFunc(fig, cmd)
|
copy.Entry.UsageFunc(fig, cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.Action(
|
cmd.Action(func(_ *kingpin.ParseContext) error {
|
||||||
func(_ *kingpin.ParseContext) error {
|
if logging.GetLevel("") > logging.DEBUG {
|
||||||
return copy.Entry.ExecuteFunc(o, &globals)
|
o = o.WithTrace(true)
|
||||||
},
|
}
|
||||||
)
|
return copy.Entry.ExecuteFunc(o, &globals)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,10 +289,30 @@ func EditorUsage(cmd *kingpin.CmdClause, opts *CommonOptions) {
|
|||||||
cmd.Flag("editor", "Editor to use").SetValue(&opts.Editor)
|
cmd.Flag("editor", "Editor to use").SetValue(&opts.Editor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func FileUsage(cmd *kingpin.CmdClause, opts *CommonOptions) {
|
||||||
|
cmd.Flag("file", "File to use").SetValue(&opts.File)
|
||||||
|
}
|
||||||
|
|
||||||
func TemplateUsage(cmd *kingpin.CmdClause, opts *CommonOptions) {
|
func TemplateUsage(cmd *kingpin.CmdClause, opts *CommonOptions) {
|
||||||
cmd.Flag("template", "Template to use for output").Short('t').SetValue(&opts.Template)
|
cmd.Flag("template", "Template to use for output").Short('t').SetValue(&opts.Template)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GJsonQueryUsage(cmd *kingpin.CmdClause, opts *CommonOptions) {
|
||||||
|
cmd.Flag("gjq", "GJSON Query to filter output, see https://goo.gl/iaYwJ5").SetValue(&opts.GJsonQuery)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *CommonOptions) PrintTemplate(data interface{}) error {
|
||||||
|
if o.GJsonQuery.Value != "" {
|
||||||
|
buf := bytes.NewBufferString("")
|
||||||
|
RunTemplate("json", data, buf)
|
||||||
|
results := gjson.GetBytes(buf.Bytes(), o.GJsonQuery.Value)
|
||||||
|
_, err := os.Stdout.Write([]byte(results.String()))
|
||||||
|
os.Stdout.Write([]byte{'\n'})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return RunTemplate(o.Template.Value, data, nil)
|
||||||
|
}
|
||||||
|
|
||||||
func (o *CommonOptions) editFile(fileName string) (changes bool, err error) {
|
func (o *CommonOptions) editFile(fileName string) (changes bool, err error) {
|
||||||
var editor string
|
var editor string
|
||||||
for _, ed := range []string{o.Editor.Value, os.Getenv("JIRA_EDITOR"), os.Getenv("EDITOR"), "vim"} {
|
for _, ed := range []string{o.Editor.Value, os.Getenv("JIRA_EDITOR"), os.Getenv("EDITOR"), "vim"} {
|
||||||
@@ -201,46 +345,55 @@ func (o *CommonOptions) editFile(fileName string) (changes bool, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// now we just need to diff the files to see if there are any changes
|
// now we just need to diff the files to see if there are any changes
|
||||||
var oldHandle, newHandle *os.File
|
f1, err := os.Open(tmpFileNameOrig)
|
||||||
var oldStat, newStat os.FileInfo
|
if err != nil {
|
||||||
if oldHandle, err = os.Open(tmpFileNameOrig); err == nil {
|
return false, err
|
||||||
if newHandle, err = os.Open(fileName); err == nil {
|
}
|
||||||
if oldStat, err = oldHandle.Stat(); err == nil {
|
f2, err := os.Open(fileName)
|
||||||
if newStat, err = newHandle.Stat(); err == nil {
|
if err != nil {
|
||||||
// different sizes, so must have changes
|
return false, err
|
||||||
if oldStat.Size() != newStat.Size() {
|
}
|
||||||
return true, err
|
|
||||||
}
|
stat1, err := f1.Stat()
|
||||||
oldBuf, newBuf := make([]byte, 1024), make([]byte, 1024)
|
if err != nil {
|
||||||
var oldCount, newCount int
|
return false, err
|
||||||
// loop though 1024 bytes at a time comparing the buffers for changes
|
}
|
||||||
for err != io.EOF {
|
stat2, err := f2.Stat()
|
||||||
oldCount, _ = oldHandle.Read(oldBuf)
|
if err != nil {
|
||||||
newCount, err = newHandle.Read(newBuf)
|
return false, err
|
||||||
if oldCount != newCount {
|
}
|
||||||
return true, nil
|
// different sizes, so must have changes
|
||||||
}
|
if stat1.Size() != stat2.Size() {
|
||||||
if bytes.Compare(oldBuf[:oldCount], newBuf[:newCount]) != 0 {
|
return true, nil
|
||||||
return true, nil
|
}
|
||||||
}
|
|
||||||
}
|
p1, p2 := make([]byte, 1024), make([]byte, 1024)
|
||||||
return false, nil
|
var n1, n2 int
|
||||||
}
|
// loop though 1024 bytes at a time comparing the buffers for changes
|
||||||
}
|
for err != io.EOF {
|
||||||
|
n1, _ = f1.Read(p1)
|
||||||
|
n2, err = f2.Read(p2)
|
||||||
|
if n1 != n2 {
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
if !bytes.Equal(p1[:n1], p2[:n2]) {
|
||||||
|
return true, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false, err
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var EditLoopAbort = fmt.Errorf("edit Loop aborted by request")
|
||||||
|
|
||||||
func EditLoop(opts *CommonOptions, input interface{}, output interface{}, submit func() error) error {
|
func EditLoop(opts *CommonOptions, input interface{}, output interface{}, submit func() error) error {
|
||||||
tmpFile, err := tmpTemplate(opts.Template.Value, input)
|
tmpFile, err := tmpTemplate(opts.Template.Value, input)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
confirm := func(msg string) (answer bool) {
|
confirm := func(dflt bool, msg string) (answer bool) {
|
||||||
survey.AskOne(
|
survey.AskOne(
|
||||||
&survey.Confirm{Message: msg, Default: true},
|
&survey.Confirm{Message: msg, Default: dflt},
|
||||||
&answer,
|
&answer,
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
@@ -261,14 +414,14 @@ func EditLoop(opts *CommonOptions, input interface{}, output interface{}, submit
|
|||||||
changes, err := opts.editFile(tmpFile)
|
changes, err := opts.editFile(tmpFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err.Error())
|
log.Error(err.Error())
|
||||||
if confirm("Editor reported an error, edit again?") {
|
if confirm(true, "Editor reported an error, edit again?") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
panic(Exit{Code: 1})
|
return EditLoopAbort
|
||||||
}
|
}
|
||||||
if !changes {
|
if !changes {
|
||||||
if !confirm("No changes detected, submit anyway?") {
|
if !confirm(false, "No changes detected, submit anyway?") {
|
||||||
panic(Exit{Code: 1})
|
return EditLoopAbort
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -301,37 +454,137 @@ func EditLoop(opts *CommonOptions, input interface{}, output interface{}, submit
|
|||||||
var raw interface{}
|
var raw interface{}
|
||||||
if err := yaml.Unmarshal(data, &raw); err != nil {
|
if err := yaml.Unmarshal(data, &raw); err != nil {
|
||||||
log.Error(err.Error())
|
log.Error(err.Error())
|
||||||
if confirm("Invalid YAML syntax, edit again?") {
|
if confirm(true, "Invalid YAML syntax, edit again?") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
panic(Exit{Code: 1})
|
return EditLoopAbort
|
||||||
}
|
}
|
||||||
yamlFixup(&raw)
|
yamlFixup(&raw)
|
||||||
fixedYAML, err := yaml.Marshal(&raw)
|
fixedYAML, err := yaml.Marshal(&raw)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err.Error())
|
log.Error(err.Error())
|
||||||
if confirm("Invalid YAML syntax, edit again?") {
|
if confirm(true, "Invalid YAML syntax, edit again?") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
panic(Exit{Code: 1})
|
return EditLoopAbort
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := yaml.Unmarshal(fixedYAML, output); err != nil {
|
if err := yaml.Unmarshal(fixedYAML, output); err != nil {
|
||||||
log.Error(err.Error())
|
log.Error(err.Error())
|
||||||
if confirm("Invalid YAML syntax, edit again?") {
|
if confirm(true, "Invalid YAML syntax, edit again?") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
panic(Exit{Code: 1})
|
return EditLoopAbort
|
||||||
}
|
}
|
||||||
// submit template
|
// submit template
|
||||||
if err := submit(); err != nil {
|
if err := submit(); err != nil {
|
||||||
log.Error(err.Error())
|
log.Error(err.Error())
|
||||||
if confirm("Jira reported an error, edit again?") {
|
if confirm(true, "Jira reported an error, edit again?") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
panic(Exit{Code: 1})
|
return EditLoopAbort
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var FileAbort = fmt.Errorf("file processing aborted")
|
||||||
|
|
||||||
|
func ReadYmlInputFile(opts *CommonOptions, input interface{}, output interface{}, submit func() error) error {
|
||||||
|
tmpFile, err := tmpTemplate(opts.Template.Value, input)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
tmpFile = opts.File.String()
|
||||||
|
|
||||||
|
// we need to copy the original output so that we can restore
|
||||||
|
// it on retries in case we try to populate bogus fields that
|
||||||
|
// are rejected by the jira service.
|
||||||
|
dup := reflect.New(reflect.ValueOf(output).Elem().Type())
|
||||||
|
err = copier.Copy(dup.Interface(), output)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// parse template
|
||||||
|
data, err := ioutil.ReadFile(tmpFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
defer func(mapType, iface reflect.Type) {
|
||||||
|
yaml.DefaultMapType = mapType
|
||||||
|
yaml.IfaceType = iface
|
||||||
|
}(yaml.DefaultMapType, yaml.IfaceType)
|
||||||
|
yaml.DefaultMapType = reflect.TypeOf(map[string]interface{}{})
|
||||||
|
yaml.IfaceType = yaml.DefaultMapType.Elem()
|
||||||
|
|
||||||
|
// restore output incase of retry loop
|
||||||
|
err = copier.Copy(output, dup.Interface())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// HACK HACK HACK we want to trim out all the yaml garbage that is not
|
||||||
|
// poplulated, like empty arrays, string values with only a newline,
|
||||||
|
// etc. We need to do this because jira will reject json documents
|
||||||
|
// with empty arrays, or empty strings typically. So here we process
|
||||||
|
// the data to a raw interface{} then we fixup the yaml parsed
|
||||||
|
// interface, then we serialize to a new yaml document ... then is
|
||||||
|
// parsed as the original document to populate the output struct. Phew.
|
||||||
|
var raw interface{}
|
||||||
|
if err := yaml.Unmarshal(data, &raw); err != nil {
|
||||||
|
log.Error(err.Error())
|
||||||
|
fmt.Printf("Invalid YAML syntax\n")
|
||||||
|
return FileAbort
|
||||||
|
}
|
||||||
|
yamlFixup(&raw)
|
||||||
|
fixedYAML, err := yaml.Marshal(&raw)
|
||||||
|
if err != nil {
|
||||||
|
log.Error(err.Error())
|
||||||
|
fmt.Printf("Invalid YAML syntax\n")
|
||||||
|
return FileAbort
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := yaml.Unmarshal(fixedYAML, output); err != nil {
|
||||||
|
log.Error(err.Error())
|
||||||
|
fmt.Printf("Invalid YAML syntax\n")
|
||||||
|
return FileAbort
|
||||||
|
}
|
||||||
|
// submit template
|
||||||
|
if err := submit(); err != nil {
|
||||||
|
log.Error(err.Error())
|
||||||
|
fmt.Printf("Jira reported an error\n")
|
||||||
|
return FileAbort
|
||||||
|
}
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package jiracli
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
logging "gopkg.in/op/go-logging.v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
log = logging.MustGetLogger("jira")
|
||||||
|
)
|
||||||
|
|
||||||
|
func IncreaseLogLevel(verbosity int) {
|
||||||
|
logging.SetLevel(logging.GetLevel("")+logging.Level(verbosity), "")
|
||||||
|
}
|
||||||
|
|
||||||
|
func InitLogging() {
|
||||||
|
logBackend := logging.NewLogBackend(os.Stderr, "", 0)
|
||||||
|
format := os.Getenv("JIRA_LOG_FORMAT")
|
||||||
|
if format == "" {
|
||||||
|
format = "%{color}%{level:-5s}%{color:reset} %{message}"
|
||||||
|
}
|
||||||
|
logging.SetBackend(
|
||||||
|
logging.NewBackendFormatter(
|
||||||
|
logBackend,
|
||||||
|
logging.MustStringFormatter(format),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
if os.Getenv("JIRA_DEBUG") == "" {
|
||||||
|
logging.SetLevel(logging.NOTICE, "")
|
||||||
|
} else {
|
||||||
|
logging.SetLevel(logging.DEBUG, "")
|
||||||
|
if verbosity, err := strconv.Atoi(os.Getenv("JIRA_DEBUG")); err == nil {
|
||||||
|
IncreaseLogLevel(verbosity)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+159
-29
@@ -3,76 +3,188 @@ package jiracli
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/go-jira/jira/jiradata"
|
||||||
"gopkg.in/AlecAivazis/survey.v1"
|
"gopkg.in/AlecAivazis/survey.v1"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (o *GlobalOptions) ProvideAuthParams() *jiradata.AuthParams {
|
func (o *GlobalOptions) ProvideAuthParams() *jiradata.AuthParams {
|
||||||
return &jiradata.AuthParams{
|
return &jiradata.AuthParams{
|
||||||
Username: o.User.Value,
|
Username: o.Login.Value,
|
||||||
Password: o.GetPass(),
|
Password: o.GetPass(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (o *GlobalOptions) keyName() string {
|
||||||
|
user := o.Login.Value
|
||||||
|
if o.AuthMethodIsToken() {
|
||||||
|
user = "api-token:" + user
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.PasswordSource.Value == "pass" {
|
||||||
|
if o.PasswordName.Value != "" {
|
||||||
|
return o.PasswordName.Value
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("GoJira/%s", user)
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.PasswordSource.Value == "gopass" {
|
||||||
|
if o.PasswordName.Value != "" {
|
||||||
|
return o.PasswordName.Value
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("GoJira/%s", user)
|
||||||
|
}
|
||||||
|
return user
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GlobalOptions) GetPasswordPath() string {
|
||||||
|
// if no password source path then just default
|
||||||
|
// to the password source name
|
||||||
|
if o.PasswordSourcePath.Value == "" {
|
||||||
|
return o.PasswordSource.Value
|
||||||
|
}
|
||||||
|
return o.PasswordSourcePath.Value
|
||||||
|
}
|
||||||
|
|
||||||
func (o *GlobalOptions) GetPass() string {
|
func (o *GlobalOptions) GetPass() string {
|
||||||
passwd := ""
|
if o.cachedPassword != "" {
|
||||||
|
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
|
||||||
passwd, err = keyringGet(o.User.Value)
|
o.cachedPassword, err = keyringGet(o.keyName())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
} else if o.PasswordSource.Value == "pass" {
|
} else if o.PasswordSource.Value == "gopass" {
|
||||||
if bin, err := exec.LookPath("pass"); err == nil {
|
log.Debugf("Querying gopass password source.")
|
||||||
buf := bytes.NewBufferString("")
|
binary := o.GetPasswordPath()
|
||||||
cmd := exec.Command(bin, fmt.Sprintf("GoJira/%s", o.User))
|
if o.PasswordDirectory.Value != "" {
|
||||||
cmd.Stdout = buf
|
orig := os.Getenv("PASSWORD_STORE_DIR")
|
||||||
cmd.Stderr = buf
|
log.Debugf("using password-directory: %s", o.PasswordDirectory)
|
||||||
if err := cmd.Run(); err == nil {
|
os.Setenv("PASSWORD_STORE_DIR", o.PasswordDirectory.Value)
|
||||||
passwd = strings.TrimSpace(buf.String())
|
defer os.Setenv("PASSWORD_STORE_DIR", orig)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if passDir := os.Getenv("PASSWORD_STORE_DIR"); passDir != "" {
|
||||||
|
log.Debugf("using PASSWORD_STORE_DIR=%s", passDir)
|
||||||
|
}
|
||||||
|
if bin, err := exec.LookPath(binary); err == nil {
|
||||||
|
log.Debugf("found gopass at: %s", bin)
|
||||||
|
buf := bytes.NewBufferString("")
|
||||||
|
cmd := exec.Command(bin, "show", "-o", o.keyName())
|
||||||
|
cmd.Stdout = buf
|
||||||
|
cmd.Stderr = os.Stderr
|
||||||
|
if err := cmd.Run(); err == nil {
|
||||||
|
o.cachedPassword = strings.TrimSpace(buf.String())
|
||||||
|
} else {
|
||||||
|
log.Warningf("gopass command failed with:\n%s", buf.String())
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.Warning("Gopass binary was not found! Fallback to default password behaviour!")
|
||||||
|
}
|
||||||
|
} else if o.PasswordSource.Value == "pass" {
|
||||||
|
log.Debugf("Querying pass password source.")
|
||||||
|
binary := o.GetPasswordPath()
|
||||||
|
if o.PasswordDirectory.Value != "" {
|
||||||
|
orig := os.Getenv("PASSWORD_STORE_DIR")
|
||||||
|
log.Debugf("using password-directory: %s", o.PasswordDirectory)
|
||||||
|
os.Setenv("PASSWORD_STORE_DIR", o.PasswordDirectory.Value)
|
||||||
|
defer os.Setenv("PASSWORD_STORE_DIR", orig)
|
||||||
|
}
|
||||||
|
if passDir := os.Getenv("PASSWORD_STORE_DIR"); passDir != "" {
|
||||||
|
log.Debugf("using PASSWORD_STORE_DIR=%s", passDir)
|
||||||
|
}
|
||||||
|
if bin, err := exec.LookPath(binary); err == nil {
|
||||||
|
log.Debugf("found pass at: %s", bin)
|
||||||
|
buf := bytes.NewBufferString("")
|
||||||
|
cmd := exec.Command(bin, o.keyName())
|
||||||
|
cmd.Stdout = buf
|
||||||
|
cmd.Stderr = os.Stderr
|
||||||
|
if err := cmd.Run(); err == nil {
|
||||||
|
o.cachedPassword = 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" {
|
||||||
|
log.Info("Reading password from stdin.")
|
||||||
|
allBytes, err := ioutil.ReadAll(os.Stdin)
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Sprintf("unable to read bytes from stdin: %s", err))
|
||||||
|
}
|
||||||
|
o.cachedPassword = string(allBytes)
|
||||||
} else {
|
} else {
|
||||||
log.Warningf("Unknown password-source: %s", o.PasswordSource)
|
log.Warningf("Unknown password-source: %s", o.PasswordSource)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if passwd != "" {
|
if o.cachedPassword != "" {
|
||||||
return passwd
|
log.Info("Password cached.")
|
||||||
|
return o.cachedPassword
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if o.cachedPassword = os.Getenv("JIRA_API_TOKEN"); o.cachedPassword != "" && o.AuthMethodIsToken() {
|
||||||
|
return o.cachedPassword
|
||||||
|
}
|
||||||
|
|
||||||
|
prompt := fmt.Sprintf("Jira Password [%s]: ", o.Login)
|
||||||
|
help := ""
|
||||||
|
|
||||||
|
if o.AuthMethodIsToken() {
|
||||||
|
prompt = fmt.Sprintf("Jira API-Token [%s]: ", o.Login)
|
||||||
|
help = "API Tokens may be required by your Jira service endpoint: https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-basic-auth-and-cookie-based-auth/"
|
||||||
|
}
|
||||||
|
|
||||||
err := survey.AskOne(
|
err := survey.AskOne(
|
||||||
&survey.Password{
|
&survey.Password{
|
||||||
Message: fmt.Sprintf("Jira Password [%s]: ", o.User),
|
Message: prompt,
|
||||||
|
Help: help,
|
||||||
},
|
},
|
||||||
&passwd,
|
&o.cachedPassword,
|
||||||
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(passwd)
|
o.SetPass(o.cachedPassword)
|
||||||
return passwd
|
return o.cachedPassword
|
||||||
}
|
}
|
||||||
|
|
||||||
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.User.Value, passwd)
|
err := keyringSet(o.keyName(), passwd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
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 == "pass" {
|
} else if o.PasswordSource.Value == "gopass" {
|
||||||
if bin, err := exec.LookPath("pass"); err == nil {
|
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)
|
log.Debugf("using %s", bin)
|
||||||
passName := fmt.Sprintf("GoJira/%s", o.User)
|
passName := o.keyName()
|
||||||
if passwd != "" {
|
if passwd != "" {
|
||||||
in := bytes.NewBufferString(fmt.Sprintf("%s\n%s\n", passwd, passwd))
|
in := bytes.NewBufferString(fmt.Sprintf("%s\n", passwd))
|
||||||
out := bytes.NewBufferString("")
|
out := bytes.NewBufferString("")
|
||||||
cmd := exec.Command(bin, "insert", "--force", passName)
|
cmd := exec.Command(bin, "insert", "--force", passName)
|
||||||
cmd.Stdin = in
|
cmd.Stdin = in
|
||||||
@@ -81,12 +193,30 @@ func (o *GlobalOptions) SetPass(passwd string) error {
|
|||||||
if err := cmd.Run(); err != nil {
|
if err := cmd.Run(); err != nil {
|
||||||
return fmt.Errorf("Failed to insert password: %s", out.String())
|
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("Gopass binary not found!")
|
||||||
|
}
|
||||||
|
} else if o.PasswordSource.Value == "pass" {
|
||||||
|
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("pass"); err == nil {
|
||||||
|
log.Debugf("using %s", bin)
|
||||||
|
passName := o.keyName()
|
||||||
|
in := bytes.NewBufferString(fmt.Sprintf("%s\n%s\n", passwd, passwd))
|
||||||
|
out := bytes.NewBufferString("")
|
||||||
|
cmd := exec.Command(bin, "insert", "--force", passName)
|
||||||
|
cmd.Stdin = in
|
||||||
|
cmd.Stdout = out
|
||||||
|
cmd.Stderr = out
|
||||||
|
if err := cmd.Run(); err != nil {
|
||||||
|
return fmt.Errorf("Failed to insert password: %s", out.String())
|
||||||
|
}
|
||||||
|
} 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)
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package jiracli
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"golang.org/x/net/proxy"
|
||||||
|
)
|
||||||
|
|
||||||
|
func socksProxy(address string) *http.Transport {
|
||||||
|
return newSocksProxyTransport(address)
|
||||||
|
}
|
||||||
|
|
||||||
|
func newSocksProxyTransport(address string) *http.Transport {
|
||||||
|
dialer, err := proxy.SOCKS5("tcp", address, nil, proxy.Direct)
|
||||||
|
if err != nil {
|
||||||
|
// TODO: whoops, return error?
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
dial := func(network, addr string) (net.Conn, error) {
|
||||||
|
return dialer.Dial(network, addr)
|
||||||
|
}
|
||||||
|
|
||||||
|
return &http.Transport{
|
||||||
|
Dial: dial,
|
||||||
|
DisableKeepAlives: true,
|
||||||
|
ResponseHeaderTimeout: 30 * time.Second,
|
||||||
|
ExpectContinueTimeout: 10 * time.Second,
|
||||||
|
}
|
||||||
|
}
|
||||||
+261
-77
@@ -9,13 +9,20 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
"github.com/mgutz/ansi"
|
|
||||||
"golang.org/x/crypto/ssh/terminal"
|
|
||||||
yaml "gopkg.in/coryb/yaml.v2"
|
yaml "gopkg.in/coryb/yaml.v2"
|
||||||
|
|
||||||
|
"github.com/Masterminds/sprig"
|
||||||
|
"github.com/coryb/figtree"
|
||||||
|
shellquote "github.com/kballard/go-shellquote"
|
||||||
|
"github.com/mgutz/ansi"
|
||||||
|
wordwrap "github.com/mitchellh/go-wordwrap"
|
||||||
|
"github.com/olekukonko/tablewriter"
|
||||||
|
"golang.org/x/crypto/ssh/terminal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func findTemplate(name string) ([]byte, error) {
|
func findTemplate(name string) ([]byte, error) {
|
||||||
@@ -30,8 +37,8 @@ func findTemplate(name string) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getTemplate(name string) (string, error) {
|
func getTemplate(name string) (string, error) {
|
||||||
if _, err := os.Stat(name); err == nil {
|
if _, err := os.Stat(".jira.d/" + name); err == nil {
|
||||||
b, err := ioutil.ReadFile(name)
|
b, err := ioutil.ReadFile(".jira.d/" + name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@@ -40,7 +47,8 @@ func getTemplate(name string) (string, error) {
|
|||||||
b, err := findTemplate(name)
|
b, err := findTemplate(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
} else if b != nil {
|
}
|
||||||
|
if b != nil {
|
||||||
return string(b), nil
|
return string(b), nil
|
||||||
}
|
}
|
||||||
if s, ok := AllTemplates[name]; ok {
|
if s, ok := AllTemplates[name]; ok {
|
||||||
@@ -60,6 +68,30 @@ func tmpTemplate(templateName string, data interface{}) (string, error) {
|
|||||||
|
|
||||||
func TemplateProcessor() *template.Template {
|
func TemplateProcessor() *template.Template {
|
||||||
funcs := map[string]interface{}{
|
funcs := map[string]interface{}{
|
||||||
|
"jira": func() string {
|
||||||
|
return os.Args[0]
|
||||||
|
},
|
||||||
|
"env": func() map[string]string {
|
||||||
|
out := map[string]string{}
|
||||||
|
for _, env := range os.Environ() {
|
||||||
|
kv := strings.SplitN(env, "=", 2)
|
||||||
|
out[kv[0]] = kv[1]
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
},
|
||||||
|
"fit": func(size int, content string) string {
|
||||||
|
return fmt.Sprintf(fmt.Sprintf("%%-%d.%ds", size, size), content)
|
||||||
|
},
|
||||||
|
"shellquote": func(content string) string {
|
||||||
|
return shellquote.Join(content)
|
||||||
|
},
|
||||||
|
"toMinJson": func(content interface{}) (string, error) {
|
||||||
|
bytes, err := json.Marshal(content)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return string(bytes), nil
|
||||||
|
},
|
||||||
"toJson": func(content interface{}) (string, error) {
|
"toJson": func(content interface{}) (string, error) {
|
||||||
bytes, err := json.MarshalIndent(content, "", " ")
|
bytes, err := json.MarshalIndent(content, "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -80,6 +112,9 @@ 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
|
||||||
},
|
},
|
||||||
@@ -94,7 +129,7 @@ func TemplateProcessor() *template.Template {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"indent": func(spaces int, content string) string {
|
"indent": func(spaces int, content string) string {
|
||||||
indent := make([]rune, spaces+1, spaces+1)
|
indent := make([]rune, spaces+1)
|
||||||
indent[0] = '\n'
|
indent[0] = '\n'
|
||||||
for i := 1; i < spaces+1; i++ {
|
for i := 1; i < spaces+1; i++ {
|
||||||
indent[i] = ' '
|
indent[i] = ' '
|
||||||
@@ -118,6 +153,13 @@ 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 {
|
||||||
|
re := regexp.MustCompile(search)
|
||||||
|
return re.ReplaceAllString(content, replace)
|
||||||
|
},
|
||||||
"split": func(sep string, content string) []string {
|
"split": func(sep string, content string) []string {
|
||||||
return strings.Split(content, sep)
|
return strings.Split(content, sep)
|
||||||
},
|
},
|
||||||
@@ -129,7 +171,7 @@ func TemplateProcessor() *template.Template {
|
|||||||
return strings.Join(vals, sep)
|
return strings.Join(vals, sep)
|
||||||
},
|
},
|
||||||
"abbrev": func(max int, content string) string {
|
"abbrev": func(max int, content string) string {
|
||||||
if len(content) > max {
|
if len(content) > max && max > 2 {
|
||||||
var buffer bytes.Buffer
|
var buffer bytes.Buffer
|
||||||
buffer.WriteString(content[:max-3])
|
buffer.WriteString(content[:max-3])
|
||||||
buffer.WriteString("...")
|
buffer.WriteString("...")
|
||||||
@@ -150,8 +192,53 @@ func TemplateProcessor() *template.Template {
|
|||||||
"dateFormat": func(format string, content string) (string, error) {
|
"dateFormat": func(format string, content string) (string, error) {
|
||||||
return dateFormat(format, content)
|
return dateFormat(format, content)
|
||||||
},
|
},
|
||||||
|
"wrap": func(width uint, content string) string {
|
||||||
|
return wordwrap.WrapString(content, width)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return template.New("gojira").Funcs(funcs)
|
return template.New("gojira").Funcs(sprig.GenericFuncMap()).Funcs(funcs)
|
||||||
|
}
|
||||||
|
|
||||||
|
func ConfigTemplate(fig *figtree.FigTree, template, command string, opts interface{}) (string, error) {
|
||||||
|
var tmp map[string]interface{}
|
||||||
|
err := ConvertType(opts, &tmp)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
fig.LoadAllConfigs(command+".yml", &tmp)
|
||||||
|
fig.LoadAllConfigs("config.yml", &tmp)
|
||||||
|
|
||||||
|
tmpl, err := TemplateProcessor().Parse(template)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
buf := bytes.NewBufferString("")
|
||||||
|
if err := tmpl.Execute(buf, &tmp); err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return buf.String(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func ConvertType(input interface{}, output interface{}) error {
|
||||||
|
// HACK HACK HACK: convert data formats to json for backwards compatibilty with templates
|
||||||
|
jsonData, err := json.Marshal(input)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
defer func(mapType, iface reflect.Type) {
|
||||||
|
yaml.DefaultMapType = mapType
|
||||||
|
yaml.IfaceType = iface
|
||||||
|
}(yaml.DefaultMapType, yaml.IfaceType)
|
||||||
|
|
||||||
|
yaml.DefaultMapType = reflect.TypeOf(map[string]interface{}{})
|
||||||
|
yaml.IfaceType = yaml.DefaultMapType.Elem()
|
||||||
|
|
||||||
|
if err := yaml.Unmarshal(jsonData, output); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func RunTemplate(templateName string, data interface{}, out io.Writer) error {
|
func RunTemplate(templateName string, data interface{}, out io.Writer) error {
|
||||||
@@ -165,54 +252,77 @@ func RunTemplate(templateName string, data interface{}, out io.Writer) error {
|
|||||||
out = os.Stdout
|
out = os.Stdout
|
||||||
}
|
}
|
||||||
|
|
||||||
// HACK HACK HACK: convert data formats to json for backwards compatibilty with templates
|
|
||||||
var rawData interface{}
|
var rawData interface{}
|
||||||
if jsonData, err := json.Marshal(data); err != nil {
|
err = ConvertType(data, &rawData)
|
||||||
return err
|
|
||||||
} else {
|
|
||||||
defer func(mapType, iface reflect.Type) {
|
|
||||||
yaml.DefaultMapType = mapType
|
|
||||||
yaml.IfaceType = iface
|
|
||||||
}(yaml.DefaultMapType, yaml.IfaceType)
|
|
||||||
|
|
||||||
yaml.DefaultMapType = reflect.TypeOf(map[string]interface{}{})
|
|
||||||
yaml.IfaceType = yaml.DefaultMapType.Elem()
|
|
||||||
|
|
||||||
if err := yaml.Unmarshal(jsonData, &rawData); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tmpl, err := TemplateProcessor().Parse(templateContent)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table := tablewriter.NewWriter(out)
|
||||||
|
table.SetAutoFormatHeaders(false)
|
||||||
|
headers := []string{}
|
||||||
|
cells := [][]string{}
|
||||||
|
tmpl, err := TemplateProcessor().Funcs(map[string]interface{}{
|
||||||
|
"defaultColWidth": func(cw int) string {
|
||||||
|
table.SetColWidth(cw)
|
||||||
|
return ""
|
||||||
|
},
|
||||||
|
"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 {
|
||||||
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
var AllTemplates = map[string]string{
|
var AllTemplates = map[string]string{
|
||||||
"component-add": defaultComponentAddTemplate,
|
"attach-list": defaultAttachListTemplate,
|
||||||
"debug": defaultDebugTemplate,
|
|
||||||
"fields": defaultDebugTemplate,
|
|
||||||
"editmeta": defaultDebugTemplate,
|
|
||||||
"transmeta": defaultDebugTemplate,
|
|
||||||
"createmeta": defaultDebugTemplate,
|
|
||||||
"issuelinktypes": defaultDebugTemplate,
|
|
||||||
"list": defaultListTemplate,
|
|
||||||
"table": defaultTableTemplate,
|
|
||||||
"view": defaultViewTemplate,
|
|
||||||
"edit": defaultEditTemplate,
|
|
||||||
"transitions": defaultTransitionsTemplate,
|
|
||||||
"components": defaultComponentsTemplate,
|
|
||||||
"issuetypes": defaultIssuetypesTemplate,
|
|
||||||
"create": defaultCreateTemplate,
|
|
||||||
"subtask": defaultSubtaskTemplate,
|
|
||||||
"comment": defaultCommentTemplate,
|
"comment": defaultCommentTemplate,
|
||||||
"transition": defaultTransitionTemplate,
|
"component-add": defaultComponentAddTemplate,
|
||||||
|
"components": defaultComponentsTemplate,
|
||||||
|
"create": defaultCreateTemplate,
|
||||||
|
"createmeta": defaultDebugTemplate,
|
||||||
|
"debug": defaultDebugTemplate,
|
||||||
|
"edit": defaultEditTemplate,
|
||||||
|
"editmeta": defaultDebugTemplate,
|
||||||
|
"epic-create": defaultEpicCreateTemplate,
|
||||||
|
"epic-list": defaultTableTemplate,
|
||||||
|
"fields": defaultDebugTemplate,
|
||||||
|
"issuelinktypes": defaultDebugTemplate,
|
||||||
|
"issuetypes": defaultIssuetypesTemplate,
|
||||||
|
"json": defaultDebugTemplate,
|
||||||
|
"list": defaultListTemplate,
|
||||||
"request": defaultDebugTemplate,
|
"request": defaultDebugTemplate,
|
||||||
|
"subtask": defaultSubtaskTemplate,
|
||||||
|
"table": defaultTableTemplate,
|
||||||
|
"transition": defaultTransitionTemplate,
|
||||||
|
"transitions": defaultTransitionsTemplate,
|
||||||
|
"transmeta": defaultDebugTemplate,
|
||||||
|
"view": defaultViewTemplate,
|
||||||
"worklog": defaultWorklogTemplate,
|
"worklog": defaultWorklogTemplate,
|
||||||
"worklogs": defaultWorklogsTemplate,
|
"worklogs": defaultWorklogsTemplate,
|
||||||
}
|
}
|
||||||
@@ -222,14 +332,42 @@ 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 */ -}}
|
||||||
{{$w := sub termWidth 92 -}}
|
{{- headers "Issue" "Summary" "Type" "Priority" "Status" "Age" "Reporter" "Assignee" -}}
|
||||||
+{{ "-" | rep 16 }}+{{ "-" | rep $w }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+{{ "-" | rep 12 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+
|
{{- range .issues -}}
|
||||||
| {{ "Issue" | printf "%-14s" }} | {{ "Summary" | printf (printf "%%-%ds" (sub $w 2)) }} | {{ "Priority" | printf "%-12s" }} | {{ "Status" | printf "%-12s" }} | {{ "Age" | printf "%-10s" }} | {{ "Reporter" | printf "%-12s" }} | {{ "Assignee" | printf "%-12s" }} |
|
{{- row -}}
|
||||||
+{{ "-" | rep 16 }}+{{ "-" | rep $w }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+{{ "-" | rep 12 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+
|
{{- cell .key -}}
|
||||||
{{ range .issues -}}
|
{{- cell .fields.summary -}}
|
||||||
| {{ .key | printf "%-14s"}} | {{ .fields.summary | abbrev (sub $w 2) | printf (printf "%%-%ds" (sub $w 2)) }} | {{.fields.priority.name | printf "%-12s" }} | {{.fields.status.name | printf "%-12s" }} | {{.fields.created | age | printf "%-10s" }} | {{if .fields.reporter}}{{ .fields.reporter.name | printf "%-12s"}}{{else}}<unassigned>{{end}} | {{if .fields.assignee }}{{.fields.assignee.name | printf "%-12s" }}{{else}}<unassigned>{{end}} |
|
{{- cell .fields.issuetype.name -}}
|
||||||
{{ end -}}
|
{{- if .fields.priority -}}
|
||||||
+{{ "-" | rep 16 }}+{{ "-" | rep $w }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+{{ "-" | rep 12 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+
|
{{- cell .fields.priority.name -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- cell "<none>" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- cell .fields.status.name -}}
|
||||||
|
{{- cell (.fields.created | age) -}}
|
||||||
|
{{- if .fields.reporter -}}
|
||||||
|
{{- cell .fields.reporter.displayName -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- cell "<unknown>" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- if .fields.assignee -}}
|
||||||
|
{{- cell .fields.assignee.displayName -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- cell "<unassigned>" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
`
|
||||||
|
|
||||||
|
const defaultAttachListTemplate = `{{/* attach list template */ -}}
|
||||||
|
{{- headers "id" "filename" "bytes" "user" "created" -}}
|
||||||
|
{{- range . -}}
|
||||||
|
{{- row -}}
|
||||||
|
{{- cell .id -}}
|
||||||
|
{{- cell .filename -}}
|
||||||
|
{{- cell .size -}}
|
||||||
|
{{- cell .author.displayName -}}
|
||||||
|
{{- cell (.created | age) -}}
|
||||||
|
{{- end -}}
|
||||||
`
|
`
|
||||||
|
|
||||||
const defaultViewTemplate = `{{/* view template */ -}}
|
const defaultViewTemplate = `{{/* view template */ -}}
|
||||||
@@ -249,11 +387,11 @@ components: {{ range .fields.components }}{{ .name }} {{end}}
|
|||||||
issuetype: {{ .fields.issuetype.name }}
|
issuetype: {{ .fields.issuetype.name }}
|
||||||
{{end -}}
|
{{end -}}
|
||||||
{{if .fields.assignee -}}
|
{{if .fields.assignee -}}
|
||||||
assignee: {{ .fields.assignee.name }}
|
assignee: {{ .fields.assignee.displayName }}
|
||||||
{{end -}}
|
{{end -}}
|
||||||
reporter: {{ if .fields.reporter }}{{ .fields.reporter.name }}{{end}}
|
reporter: {{ if .fields.reporter }}{{ .fields.reporter.displayName }}{{end}}
|
||||||
{{if .fields.customfield_10110 -}}
|
{{if .fields.customfield_10110 -}}
|
||||||
watchers: {{ range .fields.customfield_10110 }}{{ .name }} {{end}}
|
watchers: {{ range .fields.customfield_10110 }}{{ .displayName }} {{end}}
|
||||||
{{end -}}
|
{{end -}}
|
||||||
{{if .fields.issuelinks -}}
|
{{if .fields.issuelinks -}}
|
||||||
blockers: {{ range .fields.issuelinks }}{{if .outwardIssue}}{{ .outwardIssue.key }}[{{.outwardIssue.fields.status.name}}]{{end}}{{end}}
|
blockers: {{ range .fields.issuelinks }}{{if .outwardIssue}}{{ .outwardIssue.key }}[{{.outwardIssue.fields.status.name}}]{{end}}{{end}}
|
||||||
@@ -272,16 +410,16 @@ description: |
|
|||||||
{{ or .fields.description "" | indent 2 }}
|
{{ or .fields.description "" | indent 2 }}
|
||||||
{{if .fields.comment.comments}}
|
{{if .fields.comment.comments}}
|
||||||
comments:
|
comments:
|
||||||
{{ range .fields.comment.comments }} - | # {{.author.name}}, {{.created | age}} ago
|
{{ range .fields.comment.comments }} - | # {{.author.displayName}}, {{.created | age}} ago
|
||||||
{{ or .body "" | indent 4}}
|
{{ or .body "" | indent 4}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end -}}
|
{{end -}}
|
||||||
`
|
`
|
||||||
const defaultEditTemplate = `{{/* edit template */ -}}
|
const defaultEditTemplate = `{{/* edit template */ -}}
|
||||||
# issue: {{ .key }}
|
# 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:
|
||||||
@@ -291,12 +429,18 @@ fields:
|
|||||||
components: # Values: {{ range .meta.fields.components.allowedValues }}{{.name}}, {{end}}{{if .overrides.components }}{{ range (split "," .overrides.components)}}
|
components: # Values: {{ range .meta.fields.components.allowedValues }}{{.name}}, {{end}}{{if .overrides.components }}{{ range (split "," .overrides.components)}}
|
||||||
- name: {{.}}{{end}}{{else}}{{ range .fields.components }}
|
- name: {{.}}{{end}}{{else}}{{ range .fields.components }}
|
||||||
- name: {{ .name }}{{end}}{{end}}{{end}}
|
- name: {{ .name }}{{end}}{{end}}{{end}}
|
||||||
{{- if .meta.fields.assignee}}
|
{{- if .meta.fields.assignee }}
|
||||||
|
{{- if .overrides.assignee }}
|
||||||
assignee:
|
assignee:
|
||||||
name: {{ if .overrides.assignee }}{{.overrides.assignee}}{{else}}{{if .fields.assignee }}{{ .fields.assignee.name }}{{end}}{{end}}{{end}}
|
emailAddress: {{ .overrides.assignee }}
|
||||||
|
{{- else if .fields.assignee }}
|
||||||
|
assignee: {{if .fields.assignee.name}}
|
||||||
|
emailAddress: {{ or .fields.assignee.name}}
|
||||||
|
{{- else }}
|
||||||
|
emailAddress: {{.fields.assignee.emailAddress}}{{end}}{{end}}{{end}}
|
||||||
{{- if .meta.fields.reporter}}
|
{{- if .meta.fields.reporter}}
|
||||||
reporter:
|
reporter:
|
||||||
name: {{ if .overrides.reporter }}{{ .overrides.reporter }}{{else if .fields.reporter}}{{ .fields.reporter.name }}{{end}}{{end}}
|
emailAddress: {{ if .overrides.reporter }}{{ .overrides.reporter }}{{else if .fields.reporter}}{{ .fields.reporter.emailAddress }}{{end}}{{end}}
|
||||||
{{- if .meta.fields.customfield_10110}}
|
{{- if .meta.fields.customfield_10110}}
|
||||||
# watchers
|
# watchers
|
||||||
customfield_10110: {{ range .fields.customfield_10110 }}
|
customfield_10110: {{ range .fields.customfield_10110 }}
|
||||||
@@ -304,11 +448,12 @@ fields:
|
|||||||
- name: {{ .overrides.watcher}}{{end}}{{end}}
|
- name: {{ .overrides.watcher}}{{end}}{{end}}
|
||||||
{{- if .meta.fields.priority }}
|
{{- if .meta.fields.priority }}
|
||||||
priority: # Values: {{ range .meta.fields.priority.allowedValues }}{{.name}}, {{end}}
|
priority: # Values: {{ range .meta.fields.priority.allowedValues }}{{.name}}, {{end}}
|
||||||
name: {{ or .overrides.priority .fields.priority.name }}{{end}}
|
name: {{ or .overrides.priority .fields.priority.name "" }}{{end}}
|
||||||
description: |~
|
description: |~
|
||||||
{{ or .overrides.description (or .fields.description "") | indent 4 }}
|
{{ or .overrides.description .fields.description "" | indent 4 }}
|
||||||
|
# votes: {{ .fields.votes.votes }}
|
||||||
# comments:
|
# comments:
|
||||||
# {{ range .fields.comment.comments }} - | # {{.author.name}}, {{.created | age}} ago
|
# {{ range .fields.comment.comments }} - | # {{.author.displayName}}, {{.created | age}} ago
|
||||||
# {{ or .body "" | indent 4 | comment}}
|
# {{ or .body "" | indent 4 | comment}}
|
||||||
# {{end}}
|
# {{end}}
|
||||||
`
|
`
|
||||||
@@ -344,14 +489,39 @@ fields:
|
|||||||
description: |~
|
description: |~
|
||||||
{{ or .overrides.description "" | indent 4 }}{{if .meta.fields.assignee}}
|
{{ or .overrides.description "" | indent 4 }}{{if .meta.fields.assignee}}
|
||||||
assignee:
|
assignee:
|
||||||
name: {{ or .overrides.assignee "" }}{{end}}{{if .meta.fields.reporter}}
|
emailAddress: {{ or .overrides.assignee "" }}{{end}}{{if .meta.fields.reporter}}
|
||||||
reporter:
|
reporter:
|
||||||
name: {{ or .overrides.reporter .overrides.user }}{{end}}{{if .meta.fields.customfield_10110}}
|
emailAddress: {{ or .overrides.reporter .overrides.login }}{{end}}{{if .meta.fields.customfield_10110}}
|
||||||
# watchers
|
# watchers
|
||||||
customfield_10110: {{ range split "," (or .overrides.watchers "")}}
|
customfield_10110: {{ range split "," (or .overrides.watchers "")}}
|
||||||
- name: {{.}}{{end}}
|
- name: {{.}}{{end}}
|
||||||
- name:{{end}}`
|
- name:{{end}}`
|
||||||
|
|
||||||
|
const defaultEpicCreateTemplate = `{{/* epic create template */ -}}
|
||||||
|
fields:
|
||||||
|
project:
|
||||||
|
key: {{ or .overrides.project "" }}
|
||||||
|
# Epic Name
|
||||||
|
customfield_10120: {{ or (index .overrides "epic-name") "" }}
|
||||||
|
summary: >-
|
||||||
|
{{ or .overrides.summary "" }}{{if .meta.fields.priority.allowedValues}}
|
||||||
|
priority: # Values: {{ range .meta.fields.priority.allowedValues }}{{.name}}, {{end}}
|
||||||
|
name: {{ or .overrides.priority ""}}{{end}}{{if .meta.fields.components.allowedValues}}
|
||||||
|
components: # Values: {{ range .meta.fields.components.allowedValues }}{{.name}}, {{end}}{{ range split "," (or .overrides.components "")}}
|
||||||
|
- name: {{ . }}{{end}}{{end}}
|
||||||
|
description: |~
|
||||||
|
{{ or .overrides.description "" | indent 4 }}{{if .meta.fields.assignee}}
|
||||||
|
assignee:
|
||||||
|
emailAddress: {{ or .overrides.assignee "" }}{{end}}{{if .meta.fields.reporter}}
|
||||||
|
reporter:
|
||||||
|
emailAddress: {{ or .overrides.reporter .overrides.login }}{{end}}{{if .meta.fields.customfield_10110}}
|
||||||
|
# watchers
|
||||||
|
customfield_10110: {{ range split "," (or .overrides.watchers "")}}
|
||||||
|
- name: {{.}}{{end}}
|
||||||
|
- name:{{end}}
|
||||||
|
issuetype:
|
||||||
|
name: Epic`
|
||||||
|
|
||||||
const defaultSubtaskTemplate = `{{/* create subtask template */ -}}
|
const defaultSubtaskTemplate = `{{/* create subtask template */ -}}
|
||||||
fields:
|
fields:
|
||||||
project:
|
project:
|
||||||
@@ -365,9 +535,9 @@ fields:
|
|||||||
description: |~
|
description: |~
|
||||||
{{ or .overrides.description "" | indent 4 }}{{if .meta.fields.assignee}}
|
{{ or .overrides.description "" | indent 4 }}{{if .meta.fields.assignee}}
|
||||||
assignee:
|
assignee:
|
||||||
name: {{ or .overrides.assignee "" }}{{end}}{{if .meta.fields.reporter}}
|
emailAddress: {{ or .overrides.assignee "" }}{{end}}{{if .meta.fields.reporter}}
|
||||||
reporter:
|
reporter:
|
||||||
name: {{ or .overrides.reporter .overrides.user }}{{end}}{{if .meta.fields.customfield_10110}}
|
emailAddress: {{ or .overrides.reporter .overrides.login }}{{end}}{{if .meta.fields.customfield_10110}}
|
||||||
# watchers
|
# watchers
|
||||||
customfield_10110: {{ range split "," (or .overrides.watchers "")}}
|
customfield_10110: {{ range split "," (or .overrides.watchers "")}}
|
||||||
- name: {{.}}{{end}}
|
- name: {{.}}{{end}}
|
||||||
@@ -385,14 +555,20 @@ 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 -}}
|
||||||
fields:
|
fields:
|
||||||
{{- if .meta.fields.assignee}}
|
{{- if .meta.fields.assignee }}
|
||||||
|
{{- if .overrides.assignee }}
|
||||||
assignee:
|
assignee:
|
||||||
name: {{if .overrides.assignee}}{{.overrides.assignee}}{{else}}{{if .fields.assignee}}{{.fields.assignee.name}}{{end}}{{end}}
|
emailAddress: {{ .overrides.assignee }}
|
||||||
|
{{- else if .fields.assignee }}
|
||||||
|
assignee: {{if .fields.assignee.name}}
|
||||||
|
emailAddress: {{ or .fields.assignee.name}}
|
||||||
|
{{- else }}
|
||||||
|
emailAddress: {{.fields.assignee.emailAddress}}{{end}}{{end}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{if .meta.fields.components}}
|
{{if .meta.fields.components}}
|
||||||
components: # Values: {{ range .meta.fields.components.allowedValues }}{{.name}}, {{end}}{{if .overrides.components }}{{ range (split "," .overrides.components)}}
|
components: # Values: {{ range .meta.fields.components.allowedValues }}{{.name}}, {{end}}{{if .overrides.components }}{{ range (split "," .overrides.components)}}
|
||||||
@@ -400,12 +576,13 @@ fields:
|
|||||||
- name: {{ .name }}{{end}}{{end}}
|
- name: {{ .name }}{{end}}{{end}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{if .meta.fields.description}}
|
{{if .meta.fields.description}}
|
||||||
description: {{or .overrides.description .fields.description }}
|
description: |~
|
||||||
|
{{ or .fields.description "" | indent 4 }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{if .meta.fields.fixVersions -}}
|
{{if .meta.fields.fixVersions -}}
|
||||||
{{if .meta.fields.fixVersions.allowedValues}}
|
{{if .meta.fields.fixVersions.allowedValues}}
|
||||||
fixVersions: # Values: {{ range .meta.fields.fixVersions.allowedValues }}{{.name}}, {{end}}{{if .overrides.fixVersions}}{{ range (split "," .overrides.fixVersions)}}
|
fixVersions: # Values: {{ range .meta.fields.fixVersions.allowedValues }}{{.name}}, {{end}}{{if .overrides.fixVersions}}{{ range (split "," .overrides.fixVersions)}}
|
||||||
- name: {{.name}}{{end}}{{else}}{{range .fields.fixVersions}}
|
- name: {{.}}{{end}}{{else}}{{range .fields.fixVersions}}
|
||||||
- name: {{.name}}{{end}}{{end}}
|
- name: {{.name}}{{end}}{{end}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
@@ -422,9 +599,15 @@ fields:
|
|||||||
priority: # Values: {{ range .meta.fields.priority.allowedValues }}{{.name}}, {{end}}
|
priority: # Values: {{ range .meta.fields.priority.allowedValues }}{{.name}}, {{end}}
|
||||||
name: {{ or .overrides.priority "unassigned" }}
|
name: {{ or .overrides.priority "unassigned" }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{if .meta.fields.reporter}}
|
{{- if .meta.fields.reporter }}
|
||||||
|
{{- if .overrides.reporter }}
|
||||||
reporter:
|
reporter:
|
||||||
name: {{if .overrides.reporter}}{{.overrides.reporter}}{{else}}{{if .fields.reporter}}{{.fields.reporter.name}}{{end}}{{end}}
|
name: {{ .overrides.reporter }}
|
||||||
|
{{- else if .fields.reporter }}
|
||||||
|
reporter: {{if .fields.reporter.name}}
|
||||||
|
name: {{ or .fields.reporter.name}}
|
||||||
|
{{- else }}
|
||||||
|
displayName: {{.fields.reporter.displayName}}{{end}}{{end}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{if .meta.fields.resolution}}
|
{{if .meta.fields.resolution}}
|
||||||
resolution: # Values: {{ range .meta.fields.resolution.allowedValues }}{{.name}}, {{end}}
|
resolution: # Values: {{ range .meta.fields.resolution.allowedValues }}{{.name}}, {{end}}
|
||||||
@@ -447,14 +630,15 @@ transition:
|
|||||||
const defaultWorklogTemplate = `{{/* worklog template */ -}}
|
const defaultWorklogTemplate = `{{/* worklog template */ -}}
|
||||||
# issue: {{ .issue }}
|
# issue: {{ .issue }}
|
||||||
comment: |~
|
comment: |~
|
||||||
{{ or .comment "" }}
|
{{ or .comment "" | indent 2 }}
|
||||||
timeSpent: {{ or .timeSpent "" }}
|
timeSpent: {{ or .timeSpent "" }}
|
||||||
started:
|
started: {{ or .started "" }}
|
||||||
`
|
`
|
||||||
|
|
||||||
const defaultWorklogsTemplate = `{{/* worklogs template */ -}}
|
const defaultWorklogsTemplate = `{{/* worklogs template */ -}}
|
||||||
{{ range .worklogs }}- # {{.author.name}}, {{.created | age}} ago
|
{{ range .worklogs }}- # {{.author.displayName}}, {{.created | age}} ago
|
||||||
comment: {{ or .comment "" }}
|
comment: {{ or .comment "" }}
|
||||||
|
started: {{ .started }}
|
||||||
timeSpent: {{ .timeSpent }}
|
timeSpent: {{ .timeSpent }}
|
||||||
|
|
||||||
{{end}}`
|
{{end}}`
|
||||||
|
|||||||
@@ -0,0 +1,199 @@
|
|||||||
|
package jiracli
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"regexp"
|
||||||
|
"runtime"
|
||||||
|
"syscall"
|
||||||
|
|
||||||
|
"github.com/coryb/figtree"
|
||||||
|
"github.com/coryb/kingpeon"
|
||||||
|
"github.com/coryb/oreo"
|
||||||
|
jira "github.com/go-jira/jira"
|
||||||
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
var usage = `{{define "FormatCommand"}}\
|
||||||
|
{{if .FlagSummary}} {{.FlagSummary}}{{end}}\
|
||||||
|
{{range .Args}} {{if not .Required}}[{{end}}<{{.Name}}>{{if .Value|IsCumulative}}...{{end}}{{if not .Required}}]{{end}}{{end}}\
|
||||||
|
{{end}}\
|
||||||
|
|
||||||
|
{{define "FormatBriefCommands"}}\
|
||||||
|
{{range .FlattenedCommands}}\
|
||||||
|
{{if not .Hidden}}\
|
||||||
|
{{ print .FullCommand ":" | printf "%-20s"}} {{.Help}}
|
||||||
|
{{end}}\
|
||||||
|
{{end}}\
|
||||||
|
{{end}}\
|
||||||
|
|
||||||
|
{{define "FormatCommands"}}\
|
||||||
|
{{range .FlattenedCommands}}\
|
||||||
|
{{if not .Hidden}}\
|
||||||
|
{{.FullCommand}}{{if .Default}}*{{end}}{{template "FormatCommand" .}}
|
||||||
|
{{.Help|Wrap 4}}
|
||||||
|
{{with .Flags|FlagsToTwoColumns}}{{FormatTwoColumnsWithIndent . 4 2}}{{end}}
|
||||||
|
{{end}}\
|
||||||
|
{{end}}\
|
||||||
|
{{end}}\
|
||||||
|
|
||||||
|
{{define "FormatUsage"}}\
|
||||||
|
{{template "FormatCommand" .}}{{if .Commands}} <command> [<args> ...]{{end}}
|
||||||
|
{{if .Help}}
|
||||||
|
{{.Help|Wrap 0}}\
|
||||||
|
{{end}}\
|
||||||
|
|
||||||
|
{{end}}\
|
||||||
|
|
||||||
|
{{if .Context.SelectedCommand}}\
|
||||||
|
usage: {{.App.Name}} {{.Context.SelectedCommand}}{{template "FormatCommand" .Context.SelectedCommand}}
|
||||||
|
{{if .Context.SelectedCommand.Aliases }}\
|
||||||
|
{{range $top := .App.Commands}}\
|
||||||
|
{{if eq $top.FullCommand $.Context.SelectedCommand.FullCommand}}\
|
||||||
|
{{range $alias := $.Context.SelectedCommand.Aliases}}\
|
||||||
|
alias: {{$.App.Name}} {{$alias}}{{template "FormatCommand" $.Context.SelectedCommand}}
|
||||||
|
{{end}}\
|
||||||
|
{{else}}\
|
||||||
|
{{range $sub := $top.Commands}}\
|
||||||
|
{{if eq $sub.FullCommand $.Context.SelectedCommand.FullCommand}}\
|
||||||
|
{{range $alias := $.Context.SelectedCommand.Aliases}}\
|
||||||
|
alias: {{$.App.Name}} {{$top.Name}} {{$alias}}{{template "FormatCommand" $.Context.SelectedCommand}}
|
||||||
|
{{end}}\
|
||||||
|
{{end}}\
|
||||||
|
{{end}}\
|
||||||
|
{{end}}\
|
||||||
|
{{end}}\
|
||||||
|
{{end}}
|
||||||
|
{{if .Context.SelectedCommand.Help}}\
|
||||||
|
{{.Context.SelectedCommand.Help|Wrap 0}}
|
||||||
|
{{end}}\
|
||||||
|
{{else}}\
|
||||||
|
usage: {{.App.Name}}{{template "FormatUsage" .App}}
|
||||||
|
{{end}}\
|
||||||
|
|
||||||
|
{{if .App.Flags}}\
|
||||||
|
Global flags:
|
||||||
|
{{.App.Flags|FlagsToTwoColumns|FormatTwoColumns}}
|
||||||
|
{{end}}\
|
||||||
|
{{if .Context.SelectedCommand}}\
|
||||||
|
{{if and .Context.SelectedCommand.Flags|RequiredFlags}}\
|
||||||
|
Required flags:
|
||||||
|
{{.Context.SelectedCommand.Flags|RequiredFlags|FlagsToTwoColumns|FormatTwoColumns}}
|
||||||
|
{{end}}\
|
||||||
|
{{if .Context.SelectedCommand.Flags|OptionalFlags}}\
|
||||||
|
Optional flags:
|
||||||
|
{{.Context.SelectedCommand.Flags|OptionalFlags|FlagsToTwoColumns|FormatTwoColumns}}
|
||||||
|
{{end}}\
|
||||||
|
{{end}}\
|
||||||
|
{{if .Context.Args}}\
|
||||||
|
Args:
|
||||||
|
{{.Context.Args|ArgsToTwoColumns|FormatTwoColumns}}
|
||||||
|
{{end}}\
|
||||||
|
{{if .Context.SelectedCommand}}\
|
||||||
|
{{if .Context.SelectedCommand.Commands}}\
|
||||||
|
Subcommands:
|
||||||
|
{{template "FormatCommands" .Context.SelectedCommand}}
|
||||||
|
{{end}}\
|
||||||
|
{{else if .App.Commands}}\
|
||||||
|
Commands:
|
||||||
|
{{template "FormatBriefCommands" .App}}
|
||||||
|
{{end}}\
|
||||||
|
`
|
||||||
|
|
||||||
|
func CommandLine(fig *figtree.FigTree, o *oreo.Client) *kingpin.Application {
|
||||||
|
app := kingpin.New("jira", "Jira Command Line Interface")
|
||||||
|
app.HelpFlag.Short('h')
|
||||||
|
app.UsageWriter(os.Stdout)
|
||||||
|
app.ErrorWriter(os.Stderr)
|
||||||
|
app.Command("version", "Prints version").PreAction(func(*kingpin.ParseContext) error {
|
||||||
|
fmt.Println(jira.VERSION)
|
||||||
|
panic(Exit{Code: 0})
|
||||||
|
})
|
||||||
|
app.UsageTemplate(usage)
|
||||||
|
|
||||||
|
var verbosity int
|
||||||
|
app.Flag("verbose", "Increase verbosity for debugging").Short('v').PreAction(func(_ *kingpin.ParseContext) error {
|
||||||
|
os.Setenv("JIRA_DEBUG", fmt.Sprintf("%d", verbosity))
|
||||||
|
IncreaseLogLevel(1)
|
||||||
|
return nil
|
||||||
|
}).CounterVar(&verbosity)
|
||||||
|
|
||||||
|
app.Terminate(func(status int) {
|
||||||
|
for _, arg := range os.Args {
|
||||||
|
if arg == "-h" || arg == "--help" || len(os.Args) == 1 {
|
||||||
|
panic(Exit{Code: 0})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
panic(Exit{Code: 1})
|
||||||
|
})
|
||||||
|
|
||||||
|
register(app, o, fig)
|
||||||
|
|
||||||
|
// register custom commands
|
||||||
|
data := struct {
|
||||||
|
CustomCommands kingpeon.DynamicCommands `yaml:"custom-commands" json:"custom-commands"`
|
||||||
|
}{}
|
||||||
|
|
||||||
|
if err := fig.LoadAllConfigs("config.yml", &data); err != nil {
|
||||||
|
log.Errorf("%s", err)
|
||||||
|
panic(Exit{Code: 1})
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(data.CustomCommands) > 0 {
|
||||||
|
runner := syscall.Exec
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
runner = func(binary string, cmd []string, env []string) error {
|
||||||
|
command := exec.Command(binary, cmd[1:]...)
|
||||||
|
command.Stdin = os.Stdin
|
||||||
|
command.Stdout = os.Stdout
|
||||||
|
command.Stderr = os.Stderr
|
||||||
|
command.Env = env
|
||||||
|
return command.Run()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp := map[string]interface{}{}
|
||||||
|
fig.LoadAllConfigs("config.yml", &tmp)
|
||||||
|
kingpeon.RegisterDynamicCommandsWithRunner(runner, app, data.CustomCommands, TemplateProcessor())
|
||||||
|
}
|
||||||
|
|
||||||
|
return app
|
||||||
|
}
|
||||||
|
|
||||||
|
func ParseCommandLine(app *kingpin.Application, args []string) {
|
||||||
|
// checking for default usage of `jira ISSUE-123` but need to allow
|
||||||
|
// for global options first like: `jira --user mothra ISSUE-123`
|
||||||
|
ctx, err := app.ParseContext(args)
|
||||||
|
if err != nil && ctx == nil {
|
||||||
|
// This is an internal kingpin usage error, duplicate options/commands
|
||||||
|
log.Fatalf("error: %s, ctx: %v", err, ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
if ctx != nil {
|
||||||
|
if ctx.SelectedCommand == nil {
|
||||||
|
next := ctx.Next()
|
||||||
|
if next != nil {
|
||||||
|
if ok, err := regexp.MatchString("^([A-Z]+-)?[0-9]+$", next.Value); err != nil {
|
||||||
|
log.Errorf("Invalid Regex: %s", err)
|
||||||
|
} else if ok {
|
||||||
|
// insert "view" at i=1 (2nd position)
|
||||||
|
os.Args = append(os.Args[:1], append([]string{"view"}, os.Args[1:]...)...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := app.Parse(os.Args[1:]); err != nil {
|
||||||
|
if _, ok := err.(*Error); ok {
|
||||||
|
log.Errorf("%s", err)
|
||||||
|
panic(Exit{Code: 1})
|
||||||
|
}
|
||||||
|
ctx, _ := app.ParseContext(os.Args[1:])
|
||||||
|
if ctx != nil {
|
||||||
|
app.UsageForContext(ctx)
|
||||||
|
}
|
||||||
|
log.Errorf("Invalid Usage: %s", err)
|
||||||
|
panic(Exit{Code: 1})
|
||||||
|
}
|
||||||
|
}
|
||||||
+9
-5
@@ -1,11 +1,11 @@
|
|||||||
package jiracli
|
package jiracli
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -22,15 +22,19 @@ func Homedir() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func findClosestParentPath(fileName string) (string, error) {
|
func findClosestParentPath(fileName string) (string, error) {
|
||||||
paths := figtree.FindParentPaths(fileName)
|
cwd, err := os.Getwd()
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
paths := figtree.FindParentPaths(Homedir(), cwd, fileName)
|
||||||
if len(paths) > 0 {
|
if len(paths) > 0 {
|
||||||
return paths[len(paths)-1], nil
|
return paths[len(paths)-1], nil
|
||||||
}
|
}
|
||||||
return "", errors.New(fmt.Sprintf("%s not found in parent directory hierarchy", fileName))
|
return "", fmt.Errorf("%s not found in parent directory hierarchy", fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func tmpYml(tmpFilePrefix string) (*os.File, error) {
|
func tmpYml(tmpFilePrefix string) (*os.File, error) {
|
||||||
fh, err := ioutil.TempFile("", tmpFilePrefix)
|
fh, err := ioutil.TempFile("", filepath.Base(tmpFilePrefix))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -81,7 +85,7 @@ func fuzzyAge(start string) (string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
delta := time.Now().Sub(t)
|
delta := time.Since(t)
|
||||||
if delta.Minutes() < 2 {
|
if delta.Minutes() < 2 {
|
||||||
return "a minute", nil
|
return "a minute", nil
|
||||||
} else if dm := delta.Minutes(); dm < 45 {
|
} else if dm := delta.Minutes(); dm < 45 {
|
||||||
|
|||||||
+34
-5
@@ -2,16 +2,18 @@ package jiracmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/coryb/figtree"
|
"github.com/coryb/figtree"
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
"github.com/go-jira/jira"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/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"`
|
||||||
}
|
}
|
||||||
@@ -26,6 +28,7 @@ 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)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -40,19 +43,45 @@ func CmdAssignUsage(cmd *kingpin.CmdClause, opts *AssignOptions) error {
|
|||||||
return nil
|
return nil
|
||||||
}).Bool()
|
}).Bool()
|
||||||
cmd.Arg("ISSUE", "issue to assign").Required().StringVar(&opts.Issue)
|
cmd.Arg("ISSUE", "issue to assign").Required().StringVar(&opts.Issue)
|
||||||
cmd.Arg("ASSIGNEE", "user to assign to issue").StringVar(&opts.Assignee)
|
cmd.Arg("ASSIGNEE", "email or display name of user to assign to issue").StringVar(&opts.Assignee)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// CmdAssign will assign an issue to a user
|
// CmdAssign will assign an issue to a user
|
||||||
func CmdAssign(o *oreo.Client, globals *jiracli.GlobalOptions, opts *AssignOptions) error {
|
func CmdAssign(o *oreo.Client, globals *jiracli.GlobalOptions, opts *AssignOptions) error {
|
||||||
err := jira.IssueAssign(o, globals.Endpoint.Value, opts.Issue, opts.Assignee)
|
if globals.JiraDeploymentType.Value == "" {
|
||||||
|
serverInfo, err := jira.ServerInfo(o, globals.Endpoint.Value)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
globals.JiraDeploymentType.Value = strings.ToLower(serverInfo.DeploymentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
assignFunc := jira.IssueAssign
|
||||||
|
if globals.JiraDeploymentType.Value == jiracli.CloudDeploymentType {
|
||||||
|
if opts.Assignee != "" && opts.Assignee != "-1" {
|
||||||
|
users, err := jira.UserSearch(o, globals.Endpoint.Value, &jira.UserSearchOptions{
|
||||||
|
Query: opts.Assignee,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if len(users) > 1 {
|
||||||
|
return fmt.Errorf("Found %d accounts for users with username %q", len(users), opts.Assignee)
|
||||||
|
} else if len(users) == 1 {
|
||||||
|
opts.Assignee = users[0].AccountID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assignFunc = jira.IssueAssignAccountID
|
||||||
|
}
|
||||||
|
|
||||||
|
err := assignFunc(o, globals.Endpoint.Value, opts.Issue, opts.Assignee)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if !globals.Quiet.Value {
|
if !globals.Quiet.Value {
|
||||||
fmt.Printf("OK %s %s/browse/%s\n", opts.Issue, globals.Endpoint.Value, opts.Issue)
|
fmt.Printf("OK %s %s\n", opts.Issue, jira.URLJoin(globals.Endpoint.Value, "browse", opts.Issue))
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.Browse.Value {
|
if opts.Browse.Value {
|
||||||
|
|||||||
@@ -0,0 +1,101 @@
|
|||||||
|
package jiracmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"sort"
|
||||||
|
|
||||||
|
"golang.org/x/crypto/ssh/terminal"
|
||||||
|
|
||||||
|
"github.com/coryb/figtree"
|
||||||
|
"github.com/coryb/oreo"
|
||||||
|
jira "github.com/go-jira/jira"
|
||||||
|
"github.com/go-jira/jira/jiracli"
|
||||||
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||||
|
yaml "gopkg.in/coryb/yaml.v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
type AttachCreateOptions struct {
|
||||||
|
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||||
|
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||||
|
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
|
||||||
|
Attachment string `yaml:"attachment,omitempty" json:"attachment,omitempty"`
|
||||||
|
Filename string `yaml:"filename,omitempty" json:"filename,omitempty"`
|
||||||
|
SaveFile string `yaml:"savefile,omitempty" json:"savefile,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func CmdAttachCreateRegistry() *jiracli.CommandRegistryEntry {
|
||||||
|
opts := AttachCreateOptions{}
|
||||||
|
|
||||||
|
return &jiracli.CommandRegistryEntry{
|
||||||
|
"Attach file to issue",
|
||||||
|
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
|
||||||
|
jiracli.LoadConfigs(cmd, fig, &opts)
|
||||||
|
return CmdAttachCreateUsage(cmd, &opts)
|
||||||
|
},
|
||||||
|
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||||
|
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||||
|
return CmdAttachCreate(o, globals, &opts)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func CmdAttachCreateUsage(cmd *kingpin.CmdClause, opts *AttachCreateOptions) error {
|
||||||
|
jiracli.BrowseUsage(cmd, &opts.CommonOptions)
|
||||||
|
cmd.Flag("saveFile", "Write attachment information as yaml to file").StringVar(&opts.SaveFile)
|
||||||
|
cmd.Flag("filename", "Filename to use for attachment").Short('f').StringVar(&opts.Filename)
|
||||||
|
cmd.Arg("ISSUE", "issue to assign").Required().StringVar(&opts.Issue)
|
||||||
|
cmd.Arg("ATTACHMENT", "File to attach to issue, if not provided read from stdin").StringVar(&opts.Attachment)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func CmdAttachCreate(o *oreo.Client, globals *jiracli.GlobalOptions, opts *AttachCreateOptions) error {
|
||||||
|
var contents *os.File
|
||||||
|
var err error
|
||||||
|
if opts.Attachment == "" {
|
||||||
|
if terminal.IsTerminal(int(os.Stdin.Fd())) {
|
||||||
|
return fmt.Errorf("ATTACHMENT argument required or redirect from STDIN")
|
||||||
|
}
|
||||||
|
contents = os.Stdin
|
||||||
|
if opts.Filename == "" {
|
||||||
|
return fmt.Errorf("--filename required when reading from stdin")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
contents, err = os.Open(opts.Attachment)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if opts.Filename == "" {
|
||||||
|
opts.Filename = opts.Attachment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
attachments, err := jira.IssueAttachFile(o, globals.Endpoint.Value, opts.Issue, opts.Filename, contents)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
sort.Sort(sort.Reverse(attachments))
|
||||||
|
|
||||||
|
if opts.SaveFile != "" {
|
||||||
|
fh, err := os.Create(opts.SaveFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer fh.Close()
|
||||||
|
out, err := yaml.Marshal((*attachments)[0])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fh.Write(out)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !globals.Quiet.Value {
|
||||||
|
fmt.Printf("OK %d %s\n", (*attachments)[0].ID, (*attachments)[0].Content)
|
||||||
|
}
|
||||||
|
|
||||||
|
if opts.Browse.Value {
|
||||||
|
return CmdBrowse(globals, opts.Issue)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package jiracmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/coryb/figtree"
|
||||||
|
"github.com/coryb/oreo"
|
||||||
|
jira "github.com/go-jira/jira"
|
||||||
|
"github.com/go-jira/jira/jiracli"
|
||||||
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
type AttachGetOptions struct {
|
||||||
|
AttachmentID string `yaml:"attachment-id,omitempty" json:"attachment-id,omitempty"`
|
||||||
|
OutputFile string `yaml:"output-file,omitempty" json:"output-file,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func CmdAttachGetRegistry() *jiracli.CommandRegistryEntry {
|
||||||
|
opts := AttachGetOptions{}
|
||||||
|
|
||||||
|
return &jiracli.CommandRegistryEntry{
|
||||||
|
"Fetch attachment",
|
||||||
|
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
|
||||||
|
jiracli.LoadConfigs(cmd, fig, &opts)
|
||||||
|
return CmdAttachGetUsage(cmd, &opts)
|
||||||
|
},
|
||||||
|
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||||
|
return CmdAttachGet(o, globals, &opts)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func CmdAttachGetUsage(cmd *kingpin.CmdClause, opts *AttachGetOptions) error {
|
||||||
|
cmd.Flag("output", "Write attachment to specified file name, '-' for stdout").Short('o').StringVar(&opts.OutputFile)
|
||||||
|
cmd.Arg("ATTACHMENT-ID", "Attachment id to fetch").StringVar(&opts.AttachmentID)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func CmdAttachGet(o *oreo.Client, globals *jiracli.GlobalOptions, opts *AttachGetOptions) error {
|
||||||
|
attachment, err := jira.GetAttachment(o, globals.Endpoint.Value, opts.AttachmentID)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := o.Get(attachment.Content)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
var output *os.File
|
||||||
|
if opts.OutputFile == "-" {
|
||||||
|
output = os.Stdout
|
||||||
|
} else if opts.OutputFile != "" {
|
||||||
|
output, err = os.Create(opts.OutputFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer output.Close()
|
||||||
|
} else {
|
||||||
|
output, err = os.Create(attachment.Filename)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer output.Close()
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = io.Copy(output, resp.Body)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
output.Close()
|
||||||
|
if opts.OutputFile != "-" && !globals.Quiet.Value {
|
||||||
|
fmt.Printf("OK Wrote %s\n", output.Name())
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package jiracmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sort"
|
||||||
|
|
||||||
|
"github.com/coryb/figtree"
|
||||||
|
"github.com/coryb/oreo"
|
||||||
|
"github.com/go-jira/jira"
|
||||||
|
"github.com/go-jira/jira/jiracli"
|
||||||
|
"github.com/go-jira/jira/jiradata"
|
||||||
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
type AttachListOptions struct {
|
||||||
|
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||||
|
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||||
|
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func CmdAttachListRegistry() *jiracli.CommandRegistryEntry {
|
||||||
|
opts := AttachListOptions{
|
||||||
|
CommonOptions: jiracli.CommonOptions{
|
||||||
|
Template: figtree.NewStringOption("attach-list"),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return &jiracli.CommandRegistryEntry{
|
||||||
|
"Prints attachment details for issue",
|
||||||
|
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
|
||||||
|
jiracli.LoadConfigs(cmd, fig, &opts)
|
||||||
|
return CmdAttachListUsage(cmd, &opts)
|
||||||
|
},
|
||||||
|
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||||
|
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||||
|
return CmdAttachList(o, globals, &opts)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func CmdAttachListUsage(cmd *kingpin.CmdClause, opts *AttachListOptions) error {
|
||||||
|
jiracli.BrowseUsage(cmd, &opts.CommonOptions)
|
||||||
|
jiracli.TemplateUsage(cmd, &opts.CommonOptions)
|
||||||
|
cmd.Arg("ISSUE", "Issue id to lookup attachments").Required().StringVar(&opts.Issue)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func CmdAttachList(o *oreo.Client, globals *jiracli.GlobalOptions, opts *AttachListOptions) error {
|
||||||
|
data, err := jira.GetIssue(o, globals.Endpoint.Value, opts.Issue, nil)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// need to conver the interface{} "attachment" field to an actual
|
||||||
|
// ListOfAttachment object so we can sort it
|
||||||
|
var attachments jiradata.ListOfAttachment
|
||||||
|
err = jiracli.ConvertType(data.Fields["attachment"], &attachments)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
sort.Sort(&attachments)
|
||||||
|
|
||||||
|
if err := opts.PrintTemplate(attachments); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if opts.Browse.Value {
|
||||||
|
return CmdBrowse(globals, opts.Issue)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package jiracmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/coryb/figtree"
|
||||||
|
"github.com/coryb/oreo"
|
||||||
|
jira "github.com/go-jira/jira"
|
||||||
|
"github.com/go-jira/jira/jiracli"
|
||||||
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
type AttachRemoveOptions struct {
|
||||||
|
AttachmentID string `yaml:"attachment-id,omitempty" json:"attachment-id,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func CmdAttachRemoveRegistry() *jiracli.CommandRegistryEntry {
|
||||||
|
opts := AttachRemoveOptions{}
|
||||||
|
|
||||||
|
return &jiracli.CommandRegistryEntry{
|
||||||
|
"Delete attachment",
|
||||||
|
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
|
||||||
|
jiracli.LoadConfigs(cmd, fig, &opts)
|
||||||
|
return CmdAttachRemoveUsage(cmd, &opts)
|
||||||
|
},
|
||||||
|
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||||
|
return CmdAttachRemove(o, globals, &opts)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func CmdAttachRemoveUsage(cmd *kingpin.CmdClause, opts *AttachRemoveOptions) error {
|
||||||
|
cmd.Arg("ATTACHMENT-ID", "Attachment id to fetch").StringVar(&opts.AttachmentID)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func CmdAttachRemove(o *oreo.Client, globals *jiracli.GlobalOptions, opts *AttachRemoveOptions) error {
|
||||||
|
if err := jira.RemoveAttachment(o, globals.Endpoint.Value, opts.AttachmentID); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if !globals.Quiet.Value {
|
||||||
|
fmt.Printf("OK Deleted Attachment %s\n", opts.AttachmentID)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
+10
-7
@@ -6,15 +6,16 @@ import (
|
|||||||
"github.com/coryb/figtree"
|
"github.com/coryb/figtree"
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
|
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
"github.com/go-jira/jira"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
"github.com/go-jira/jira/jiracli"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/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 {
|
||||||
@@ -38,6 +39,8 @@ 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)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -53,8 +56,8 @@ func CmdBlockUsage(cmd *kingpin.CmdClause, opts *BlockOptions) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}).String()
|
}).String()
|
||||||
cmd.Arg("BLOCKER", "blocker issue").Required().StringVar(&opts.OutwardIssue.Key)
|
cmd.Arg("ISSUE", "issue that is blocked").Required().StringVar(&opts.OutwardIssue.Key)
|
||||||
cmd.Arg("ISSUE", "issue that is blocked").Required().StringVar(&opts.InwardIssue.Key)
|
cmd.Arg("BLOCKER", "blocker issue").Required().StringVar(&opts.InwardIssue.Key)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,8 +69,8 @@ func CmdBlock(o *oreo.Client, globals *jiracli.GlobalOptions, opts *BlockOptions
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !globals.Quiet.Value {
|
if !globals.Quiet.Value {
|
||||||
fmt.Printf("OK %s %s/browse/%s\n", opts.InwardIssue.Key, globals.Endpoint.Value, opts.InwardIssue.Key)
|
fmt.Printf("OK %s %s\n", opts.InwardIssue.Key, jira.URLJoin(globals.Endpoint.Value, "browse", opts.InwardIssue.Key))
|
||||||
fmt.Printf("OK %s %s/browse/%s\n", opts.OutwardIssue.Key, globals.Endpoint.Value, opts.OutwardIssue.Key)
|
fmt.Printf("OK %s %s\n", opts.OutwardIssue.Key, jira.URLJoin(globals.Endpoint.Value, "browse", opts.OutwardIssue.Key))
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.Browse.Value {
|
if opts.Browse.Value {
|
||||||
|
|||||||
+13
-7
@@ -1,31 +1,37 @@
|
|||||||
package jiracmd
|
package jiracmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/coryb/figtree"
|
"github.com/coryb/figtree"
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
|
jira "github.com/go-jira/jira"
|
||||||
|
"github.com/go-jira/jira/jiracli"
|
||||||
"github.com/pkg/browser"
|
"github.com/pkg/browser"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
|
||||||
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 {
|
||||||
issue := ""
|
opts := BrowseOptions{}
|
||||||
|
|
||||||
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(&issue)
|
cmd.Arg("ISSUE", "Issue to browse to").Required().StringVar(&opts.Issue)
|
||||||
|
jiracli.LoadConfigs(cmd, fig, &opts)
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||||
return CmdBrowse(globals, issue)
|
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||||
|
return CmdBrowse(globals, opts.Issue)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CmdBrowse open the default system browser to the provided issue
|
// CmdBrowse open the default system browser to the provided issue
|
||||||
func CmdBrowse(globals *jiracli.GlobalOptions, issue string) error {
|
func CmdBrowse(globals *jiracli.GlobalOptions, issue string) error {
|
||||||
return browser.OpenURL(fmt.Sprintf("%s/browse/%s", globals.Endpoint.Value, issue))
|
return browser.OpenURL(jira.URLJoin(globals.Endpoint.Value, "browse", issue))
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-4
@@ -6,14 +6,15 @@ import (
|
|||||||
"github.com/coryb/figtree"
|
"github.com/coryb/figtree"
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
|
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
"github.com/go-jira/jira"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
"github.com/go-jira/jira/jiracli"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/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"`
|
||||||
}
|
}
|
||||||
@@ -33,6 +34,7 @@ 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)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -68,7 +70,7 @@ func CmdComment(o *oreo.Client, globals *jiracli.GlobalOptions, opts *CommentOpt
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !globals.Quiet.Value {
|
if !globals.Quiet.Value {
|
||||||
fmt.Printf("OK %s %s/browse/%s\n", opts.Issue, globals.Endpoint.Value, opts.Issue)
|
fmt.Printf("OK %s %s\n", opts.Issue, jira.URLJoin(globals.Endpoint.Value, "browse", opts.Issue))
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.Browse.Value {
|
if opts.Browse.Value {
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import (
|
|||||||
"github.com/coryb/figtree"
|
"github.com/coryb/figtree"
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
|
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
"github.com/go-jira/jira"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
"github.com/go-jira/jira/jiracli"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
"github.com/go-jira/jira/jiradata"
|
||||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -52,9 +52,8 @@ func CmdComponentAddUsage(cmd *kingpin.CmdClause, opts *ComponentAddOptions) err
|
|||||||
func CmdComponentAdd(o *oreo.Client, globals *jiracli.GlobalOptions, opts *ComponentAddOptions) error {
|
func CmdComponentAdd(o *oreo.Client, globals *jiracli.GlobalOptions, opts *ComponentAddOptions) error {
|
||||||
var err error
|
var err error
|
||||||
component := &jiradata.Component{}
|
component := &jiradata.Component{}
|
||||||
var resp *jiradata.Component
|
|
||||||
err = jiracli.EditLoop(&opts.CommonOptions, &opts.Component, component, func() error {
|
err = jiracli.EditLoop(&opts.CommonOptions, &opts.Component, component, func() error {
|
||||||
resp, err = jira.CreateComponent(o, globals.Endpoint.Value, component)
|
_, err = jira.CreateComponent(o, globals.Endpoint.Value, component)
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import (
|
|||||||
"github.com/coryb/figtree"
|
"github.com/coryb/figtree"
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
|
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
"github.com/go-jira/jira"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
"github.com/go-jira/jira/jiracli"
|
||||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -37,6 +37,7 @@ func CmdComponentsRegistry() *jiracli.CommandRegistryEntry {
|
|||||||
|
|
||||||
func CmdComponentsUsage(cmd *kingpin.CmdClause, opts *ComponentsOptions) error {
|
func CmdComponentsUsage(cmd *kingpin.CmdClause, opts *ComponentsOptions) error {
|
||||||
jiracli.TemplateUsage(cmd, &opts.CommonOptions)
|
jiracli.TemplateUsage(cmd, &opts.CommonOptions)
|
||||||
|
jiracli.GJsonQueryUsage(cmd, &opts.CommonOptions)
|
||||||
cmd.Flag("project", "project to list components").Short('p').StringVar(&opts.Project)
|
cmd.Flag("project", "project to list components").Short('p').StringVar(&opts.Project)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@@ -51,5 +52,5 @@ func CmdComponents(o *oreo.Client, globals *jiracli.GlobalOptions, opts *Compone
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return jiracli.RunTemplate(opts.Template.Value, data, nil)
|
return opts.PrintTemplate(data)
|
||||||
}
|
}
|
||||||
|
|||||||
+41
-10
@@ -3,13 +3,14 @@ package jiracmd
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/coryb/figtree"
|
"github.com/coryb/figtree"
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
|
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
"github.com/go-jira/jira"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
"github.com/go-jira/jira/jiracli"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/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"
|
||||||
)
|
)
|
||||||
@@ -18,6 +19,7 @@ type CreateOptions struct {
|
|||||||
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||||
jiradata.IssueUpdate `yaml:",inline" json:",inline" figtree:",inline"`
|
jiradata.IssueUpdate `yaml:",inline" json:",inline" figtree:",inline"`
|
||||||
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||||
|
Summary string `yaml:"summary,omitempty" json:"summary`
|
||||||
IssueType string `yaml:"issuetype,omitempty" json:"issuetype,omitempty"`
|
IssueType string `yaml:"issuetype,omitempty" json:"issuetype,omitempty"`
|
||||||
Overrides map[string]string `yaml:"overrides,omitempty" json:"overrides,omitempty"`
|
Overrides map[string]string `yaml:"overrides,omitempty" json:"overrides,omitempty"`
|
||||||
SaveFile string `yaml:"savefile,omitempty" json:"savefile,omitempty"`
|
SaveFile string `yaml:"savefile,omitempty" json:"savefile,omitempty"`
|
||||||
@@ -46,9 +48,11 @@ func CmdCreateRegistry() *jiracli.CommandRegistryEntry {
|
|||||||
func CmdCreateUsage(cmd *kingpin.CmdClause, opts *CreateOptions) error {
|
func CmdCreateUsage(cmd *kingpin.CmdClause, opts *CreateOptions) error {
|
||||||
jiracli.BrowseUsage(cmd, &opts.CommonOptions)
|
jiracli.BrowseUsage(cmd, &opts.CommonOptions)
|
||||||
jiracli.EditorUsage(cmd, &opts.CommonOptions)
|
jiracli.EditorUsage(cmd, &opts.CommonOptions)
|
||||||
|
jiracli.FileUsage(cmd, &opts.CommonOptions)
|
||||||
jiracli.TemplateUsage(cmd, &opts.CommonOptions)
|
jiracli.TemplateUsage(cmd, &opts.CommonOptions)
|
||||||
cmd.Flag("noedit", "Disable opening the editor").SetValue(&opts.SkipEditing)
|
cmd.Flag("noedit", "Disable opening the editor").SetValue(&opts.SkipEditing)
|
||||||
cmd.Flag("project", "project to create issue in").Short('p').StringVar(&opts.Project)
|
cmd.Flag("project", "project to create issue in").Short('p').StringVar(&opts.Project)
|
||||||
|
cmd.Flag("summary", "Summary of the issue").Short('s').StringVar(&opts.Summary)
|
||||||
cmd.Flag("issuetype", "issuetype in to create").Short('i').StringVar(&opts.IssueType)
|
cmd.Flag("issuetype", "issuetype in to create").Short('i').StringVar(&opts.IssueType)
|
||||||
cmd.Flag("comment", "Comment message for issue").Short('m').PreAction(func(ctx *kingpin.ParseContext) error {
|
cmd.Flag("comment", "Comment message for issue").Short('m').PreAction(func(ctx *kingpin.ParseContext) error {
|
||||||
opts.Overrides["comment"] = jiracli.FlagValue(ctx, "comment")
|
opts.Overrides["comment"] = jiracli.FlagValue(ctx, "comment")
|
||||||
@@ -62,6 +66,14 @@ func CmdCreateUsage(cmd *kingpin.CmdClause, opts *CreateOptions) error {
|
|||||||
// CmdCreate sends the create-metadata to the "create" template for editing, then
|
// CmdCreate sends the create-metadata to the "create" template for editing, then
|
||||||
// will parse the edited document as YAML and submit the document to jira.
|
// will parse the edited document as YAML and submit the document to jira.
|
||||||
func CmdCreate(o *oreo.Client, globals *jiracli.GlobalOptions, opts *CreateOptions) error {
|
func CmdCreate(o *oreo.Client, globals *jiracli.GlobalOptions, opts *CreateOptions) error {
|
||||||
|
if globals.JiraDeploymentType.Value == "" {
|
||||||
|
serverInfo, err := jira.ServerInfo(o, globals.Endpoint.Value)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
globals.JiraDeploymentType.Value = strings.ToLower(serverInfo.DeploymentType)
|
||||||
|
}
|
||||||
|
|
||||||
type templateInput struct {
|
type templateInput struct {
|
||||||
Meta *jiradata.IssueType `yaml:"meta" json:"meta"`
|
Meta *jiradata.IssueType `yaml:"meta" json:"meta"`
|
||||||
Overrides map[string]string `yaml:"overrides" json:"overrides"`
|
Overrides map[string]string `yaml:"overrides" json:"overrides"`
|
||||||
@@ -81,20 +93,39 @@ func CmdCreate(o *oreo.Client, globals *jiracli.GlobalOptions, opts *CreateOptio
|
|||||||
Overrides: opts.Overrides,
|
Overrides: opts.Overrides,
|
||||||
}
|
}
|
||||||
input.Overrides["project"] = opts.Project
|
input.Overrides["project"] = opts.Project
|
||||||
|
if opts.Summary != "" {
|
||||||
|
input.Overrides["summary"] = opts.Summary
|
||||||
|
}
|
||||||
input.Overrides["issuetype"] = opts.IssueType
|
input.Overrides["issuetype"] = opts.IssueType
|
||||||
input.Overrides["user"] = globals.User.Value
|
input.Overrides["login"] = globals.Login.Value
|
||||||
|
|
||||||
var issueResp *jiradata.IssueCreateResponse
|
var issueResp *jiradata.IssueCreateResponse
|
||||||
err = jiracli.EditLoop(&opts.CommonOptions, &input, &issueUpdate, func() error {
|
var fnameOptsFile string
|
||||||
issueResp, err = jira.CreateIssue(o, globals.Endpoint.Value, &issueUpdate)
|
fnameOptsFile = opts.File.String()
|
||||||
return err
|
if fnameOptsFile != "" {
|
||||||
})
|
err = jiracli.ReadYmlInputFile(&opts.CommonOptions, &input, &issueUpdate, func() error {
|
||||||
|
issueResp, err = jira.CreateIssue(o, globals.Endpoint.Value, &issueUpdate)
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
err = jiracli.EditLoop(&opts.CommonOptions, &input, &issueUpdate, func() error {
|
||||||
|
if globals.JiraDeploymentType.Value == jiracli.CloudDeploymentType {
|
||||||
|
err := fixGDPRUserFields(o, globals.Endpoint.Value, createMeta.Fields, issueUpdate.Fields)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
issueResp, err = jira.CreateIssue(o, globals.Endpoint.Value, &issueUpdate)
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
browseLink := jira.URLJoin(globals.Endpoint.Value, "browse", issueResp.Key)
|
||||||
if !globals.Quiet.Value {
|
if !globals.Quiet.Value {
|
||||||
fmt.Printf("OK %s %s/browse/%s\n", issueResp.Key, globals.Endpoint.Value, issueResp.Key)
|
fmt.Printf("OK %s %s\n", issueResp.Key, browseLink)
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.SaveFile != "" {
|
if opts.SaveFile != "" {
|
||||||
@@ -105,7 +136,7 @@ func CmdCreate(o *oreo.Client, globals *jiracli.GlobalOptions, opts *CreateOptio
|
|||||||
defer fh.Close()
|
defer fh.Close()
|
||||||
out, err := yaml.Marshal(map[string]string{
|
out, err := yaml.Marshal(map[string]string{
|
||||||
"issue": issueResp.Key,
|
"issue": issueResp.Key,
|
||||||
"link": fmt.Sprintf("%s/browse/%s", globals.Endpoint.Value, issueResp.Key),
|
"link": browseLink,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package jiracmd
|
|||||||
import (
|
import (
|
||||||
"github.com/coryb/figtree"
|
"github.com/coryb/figtree"
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
"github.com/go-jira/jira"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
"github.com/go-jira/jira/jiracli"
|
||||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -35,6 +35,7 @@ func CmdCreateMetaRegistry() *jiracli.CommandRegistryEntry {
|
|||||||
|
|
||||||
func CmdCreateMetaUsage(cmd *kingpin.CmdClause, opts *CreateMetaOptions) error {
|
func CmdCreateMetaUsage(cmd *kingpin.CmdClause, opts *CreateMetaOptions) error {
|
||||||
jiracli.TemplateUsage(cmd, &opts.CommonOptions)
|
jiracli.TemplateUsage(cmd, &opts.CommonOptions)
|
||||||
|
jiracli.GJsonQueryUsage(cmd, &opts.CommonOptions)
|
||||||
cmd.Flag("project", "project to fetch create metadata").Short('p').StringVar(&opts.Project)
|
cmd.Flag("project", "project to fetch create metadata").Short('p').StringVar(&opts.Project)
|
||||||
cmd.Flag("issuetype", "issuetype in project to fetch create metadata").Short('i').StringVar(&opts.IssueType)
|
cmd.Flag("issuetype", "issuetype in project to fetch create metadata").Short('i').StringVar(&opts.IssueType)
|
||||||
return nil
|
return nil
|
||||||
@@ -49,5 +50,5 @@ func CmdCreateMeta(o *oreo.Client, globals *jiracli.GlobalOptions, opts *CreateM
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return jiracli.RunTemplate(opts.Template.Value, createMeta, nil)
|
return opts.PrintTemplate(createMeta)
|
||||||
}
|
}
|
||||||
|
|||||||
+32
-30
@@ -6,17 +6,16 @@ import (
|
|||||||
"github.com/coryb/figtree"
|
"github.com/coryb/figtree"
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
|
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
"github.com/go-jira/jira"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
"github.com/go-jira/jira/jiracli"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/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"`
|
||||||
Duplicate string `yaml:"duplicate,omitempty" json:"duplicate,omitempty"`
|
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||||
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func CmdDupRegistry() *jiracli.CommandRegistryEntry {
|
func CmdDupRegistry() *jiracli.CommandRegistryEntry {
|
||||||
@@ -40,6 +39,8 @@ 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)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -60,14 +61,14 @@ func CmdDupUsage(cmd *kingpin.CmdClause, opts *DupOptions) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// CmdDups will update the given issue as being a duplicate by the given dup issue
|
// CmdDup will update the given issue as being a duplicate by the given dup issue
|
||||||
// and will attempt to resolve the dup issue
|
// and will attempt to resolve the dup issue
|
||||||
func CmdDup(o *oreo.Client, globals *jiracli.GlobalOptions, opts *DupOptions) error {
|
func CmdDup(o *oreo.Client, globals *jiracli.GlobalOptions, opts *DupOptions) error {
|
||||||
if err := jira.LinkIssues(o, globals.Endpoint.Value, &opts.LinkIssueRequest); err != nil {
|
if err := jira.LinkIssues(o, globals.Endpoint.Value, &opts.LinkIssueRequest); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if !globals.Quiet.Value {
|
if !globals.Quiet.Value {
|
||||||
fmt.Printf("OK %s %s/browse/%s\n", opts.OutwardIssue.Key, globals.Endpoint.Value, opts.OutwardIssue.Key)
|
fmt.Printf("OK %s %s\n", opts.OutwardIssue.Key, jira.URLJoin(globals.Endpoint.Value, "browse", opts.OutwardIssue.Key))
|
||||||
}
|
}
|
||||||
|
|
||||||
meta, err := jira.GetIssueTransitions(o, globals.Endpoint.Value, opts.InwardIssue.Key)
|
meta, err := jira.GetIssueTransitions(o, globals.Endpoint.Value, opts.InwardIssue.Key)
|
||||||
@@ -76,34 +77,35 @@ func CmdDup(o *oreo.Client, globals *jiracli.GlobalOptions, opts *DupOptions) er
|
|||||||
}
|
}
|
||||||
for _, trans := range []string{"close", "done", "cancel", "start", "stop"} {
|
for _, trans := range []string{"close", "done", "cancel", "start", "stop"} {
|
||||||
transMeta := meta.Transitions.Find(trans)
|
transMeta := meta.Transitions.Find(trans)
|
||||||
if transMeta != nil {
|
if transMeta == nil {
|
||||||
issueUpdate := jiradata.IssueUpdate{
|
continue
|
||||||
Transition: transMeta,
|
}
|
||||||
}
|
issueUpdate := jiradata.IssueUpdate{
|
||||||
resolution := defaultResolution(transMeta)
|
Transition: transMeta,
|
||||||
if resolution != "" {
|
}
|
||||||
issueUpdate.Fields = map[string]interface{}{
|
resolution := defaultResolution(transMeta)
|
||||||
"resolution": map[string]interface{}{
|
if resolution != "" {
|
||||||
"name": resolution,
|
issueUpdate.Fields = map[string]interface{}{
|
||||||
},
|
"resolution": map[string]interface{}{
|
||||||
}
|
"name": resolution,
|
||||||
}
|
},
|
||||||
if err = jira.TransitionIssue(o, globals.Endpoint.Value, opts.InwardIssue.Key, &issueUpdate); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if trans != "start" {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
// if we are here then we must be stopping, so need to reset the meta
|
|
||||||
meta, err = jira.GetIssueTransitions(o, globals.Endpoint.Value, opts.InwardIssue.Key)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if err = jira.TransitionIssue(o, globals.Endpoint.Value, opts.InwardIssue.Key, &issueUpdate); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if trans != "start" {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
// if we are here then we must be stopping, so need to reset the meta
|
||||||
|
meta, err = jira.GetIssueTransitions(o, globals.Endpoint.Value, opts.InwardIssue.Key)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !globals.Quiet.Value {
|
if !globals.Quiet.Value {
|
||||||
fmt.Printf("OK %s %s/browse/%s\n", opts.InwardIssue.Key, globals.Endpoint.Value, opts.InwardIssue.Key)
|
fmt.Printf("OK %s %s\n", opts.InwardIssue.Key, jira.URLJoin(globals.Endpoint.Value, "browse", opts.InwardIssue.Key))
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.Browse.Value {
|
if opts.Browse.Value {
|
||||||
|
|||||||
+136
-11
@@ -2,13 +2,14 @@ package jiracmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/coryb/figtree"
|
"github.com/coryb/figtree"
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
|
"github.com/go-jira/jira"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
"github.com/go-jira/jira/jiracli"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
"github.com/go-jira/jira/jiradata"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
"gopkg.in/AlecAivazis/survey.v1"
|
||||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -18,6 +19,7 @@ type EditOptions struct {
|
|||||||
jira.SearchOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
jira.SearchOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||||
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"`
|
||||||
|
Queries map[string]string `yaml:"queries,omitempty" json:"queries,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func CmdEditRegistry() *jiracli.CommandRegistryEntry {
|
func CmdEditRegistry() *jiracli.CommandRegistryEntry {
|
||||||
@@ -32,19 +34,32 @@ func CmdEditRegistry() *jiracli.CommandRegistryEntry {
|
|||||||
"Edit issue details",
|
"Edit issue details",
|
||||||
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
|
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
|
||||||
jiracli.LoadConfigs(cmd, fig, &opts)
|
jiracli.LoadConfigs(cmd, fig, &opts)
|
||||||
return CmdEditUsage(cmd, &opts)
|
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 == "" {
|
||||||
|
opts.QueryFields = "assignee,created,priority,reporter,status,summary,updated,issuetype,comment,description,votes,created,customfield_10110,components"
|
||||||
|
}
|
||||||
return CmdEdit(o, globals, &opts)
|
return CmdEdit(o, globals, &opts)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func CmdEditUsage(cmd *kingpin.CmdClause, opts *EditOptions) error {
|
func CmdEditUsage(cmd *kingpin.CmdClause, opts *EditOptions, fig *figtree.FigTree) error {
|
||||||
jiracli.BrowseUsage(cmd, &opts.CommonOptions)
|
jiracli.BrowseUsage(cmd, &opts.CommonOptions)
|
||||||
jiracli.EditorUsage(cmd, &opts.CommonOptions)
|
jiracli.EditorUsage(cmd, &opts.CommonOptions)
|
||||||
jiracli.TemplateUsage(cmd, &opts.CommonOptions)
|
jiracli.TemplateUsage(cmd, &opts.CommonOptions)
|
||||||
cmd.Flag("noedit", "Disable opening the editor").SetValue(&opts.SkipEditing)
|
cmd.Flag("noedit", "Disable opening the editor").SetValue(&opts.SkipEditing)
|
||||||
|
cmd.Flag("named-query", "The name of a query in the `queries` configuration").Short('n').PreAction(func(ctx *kingpin.ParseContext) error {
|
||||||
|
name := jiracli.FlagValue(ctx, "named-query")
|
||||||
|
if query, ok := opts.Queries[name]; ok && query != "" {
|
||||||
|
var err error
|
||||||
|
opts.Query, err = jiracli.ConfigTemplate(fig, query, cmd.FullCommand(), opts)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return fmt.Errorf("A valid named-query %q not found in `queries` configuration", name)
|
||||||
|
}).String()
|
||||||
cmd.Flag("query", "Jira Query Language (JQL) expression for the search to edit multiple issues").Short('q').StringVar(&opts.Query)
|
cmd.Flag("query", "Jira Query Language (JQL) expression for the search to edit multiple issues").Short('q').StringVar(&opts.Query)
|
||||||
cmd.Flag("comment", "Comment message for issue").Short('m').PreAction(func(ctx *kingpin.ParseContext) error {
|
cmd.Flag("comment", "Comment message for issue").Short('m').PreAction(func(ctx *kingpin.ParseContext) error {
|
||||||
opts.Overrides["comment"] = jiracli.FlagValue(ctx, "comment")
|
opts.Overrides["comment"] = jiracli.FlagValue(ctx, "comment")
|
||||||
@@ -57,6 +72,14 @@ func CmdEditUsage(cmd *kingpin.CmdClause, opts *EditOptions) error {
|
|||||||
|
|
||||||
// Edit will get issue data and send to "edit" template
|
// Edit will get issue data and send to "edit" template
|
||||||
func CmdEdit(o *oreo.Client, globals *jiracli.GlobalOptions, opts *EditOptions) error {
|
func CmdEdit(o *oreo.Client, globals *jiracli.GlobalOptions, opts *EditOptions) error {
|
||||||
|
if globals.JiraDeploymentType.Value == "" {
|
||||||
|
serverInfo, err := jira.ServerInfo(o, globals.Endpoint.Value)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
globals.JiraDeploymentType.Value = strings.ToLower(serverInfo.DeploymentType)
|
||||||
|
}
|
||||||
|
|
||||||
type templateInput struct {
|
type templateInput struct {
|
||||||
*jiradata.Issue `yaml:",inline"`
|
*jiradata.Issue `yaml:",inline"`
|
||||||
Meta *jiradata.EditMeta `yaml:"meta" json:"meta"`
|
Meta *jiradata.EditMeta `yaml:"meta" json:"meta"`
|
||||||
@@ -79,23 +102,30 @@ func CmdEdit(o *oreo.Client, globals *jiracli.GlobalOptions, opts *EditOptions)
|
|||||||
Overrides: opts.Overrides,
|
Overrides: opts.Overrides,
|
||||||
}
|
}
|
||||||
err = jiracli.EditLoop(&opts.CommonOptions, &input, &issueUpdate, func() error {
|
err = jiracli.EditLoop(&opts.CommonOptions, &input, &issueUpdate, func() error {
|
||||||
|
if globals.JiraDeploymentType.Value == jiracli.CloudDeploymentType {
|
||||||
|
err := fixGDPRUserFields(o, globals.Endpoint.Value, editMeta.Fields, issueUpdate.Fields)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
return jira.EditIssue(o, globals.Endpoint.Value, opts.Issue, &issueUpdate)
|
return jira.EditIssue(o, globals.Endpoint.Value, opts.Issue, &issueUpdate)
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if !globals.Quiet.Value {
|
if !globals.Quiet.Value {
|
||||||
fmt.Printf("OK %s %s/browse/%s\n", opts.Issue, globals.Endpoint.Value, opts.Issue)
|
fmt.Printf("OK %s %s\n", opts.Issue, jira.URLJoin(globals.Endpoint.Value, "browse", opts.Issue))
|
||||||
}
|
}
|
||||||
if opts.Browse.Value {
|
if opts.Browse.Value {
|
||||||
return CmdBrowse(globals, opts.Issue)
|
return CmdBrowse(globals, opts.Issue)
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
results, err := jira.Search(o, globals.Endpoint.Value, opts)
|
results, err := jira.Search(o, globals.Endpoint.Value, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for _, issueData := range results.Issues {
|
for i, issueData := range results.Issues {
|
||||||
editMeta, err := jira.GetIssueEditMeta(o, globals.Endpoint.Value, issueData.Key)
|
editMeta, err := jira.GetIssueEditMeta(o, globals.Endpoint.Value, issueData.Key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -103,17 +133,39 @@ func CmdEdit(o *oreo.Client, globals *jiracli.GlobalOptions, opts *EditOptions)
|
|||||||
|
|
||||||
issueUpdate := jiradata.IssueUpdate{}
|
issueUpdate := jiradata.IssueUpdate{}
|
||||||
input := templateInput{
|
input := templateInput{
|
||||||
Issue: issueData,
|
Issue: issueData,
|
||||||
Meta: editMeta,
|
Meta: editMeta,
|
||||||
|
Overrides: opts.Overrides,
|
||||||
}
|
}
|
||||||
err = jiracli.EditLoop(&opts.CommonOptions, &input, &issueUpdate, func() error {
|
err = jiracli.EditLoop(&opts.CommonOptions, &input, &issueUpdate, func() error {
|
||||||
|
if globals.JiraDeploymentType.Value == jiracli.CloudDeploymentType {
|
||||||
|
err := fixGDPRUserFields(o, globals.Endpoint.Value, editMeta.Fields, issueUpdate.Fields)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
return jira.EditIssue(o, globals.Endpoint.Value, issueData.Key, &issueUpdate)
|
return jira.EditIssue(o, globals.Endpoint.Value, issueData.Key, &issueUpdate)
|
||||||
})
|
})
|
||||||
|
if err == jiracli.EditLoopAbort && len(results.Issues) > i+1 {
|
||||||
|
var answer bool
|
||||||
|
survey.AskOne(
|
||||||
|
&survey.Confirm{
|
||||||
|
Message: fmt.Sprintf("Continue to edit next issue %s?", results.Issues[i+1].Key),
|
||||||
|
Default: true,
|
||||||
|
},
|
||||||
|
&answer,
|
||||||
|
nil,
|
||||||
|
)
|
||||||
|
if answer {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
panic(jiracli.Exit{1})
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if !globals.Quiet.Value {
|
if !globals.Quiet.Value {
|
||||||
fmt.Printf("OK %s %s/browse/%s\n", issueData.Key, globals.Endpoint.Value, issueData.Key)
|
fmt.Printf("OK %s %s\n", issueData.Key, jira.URLJoin(globals.Endpoint.Value, "browse", issueData.Key))
|
||||||
}
|
}
|
||||||
if opts.Browse.Value {
|
if opts.Browse.Value {
|
||||||
return CmdBrowse(globals, issueData.Key)
|
return CmdBrowse(globals, issueData.Key)
|
||||||
@@ -121,3 +173,76 @@ func CmdEdit(o *oreo.Client, globals *jiracli.GlobalOptions, opts *EditOptions)
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func fixUserField(ua jira.HttpClient, endpoint string, userField map[string]interface{}) error {
|
||||||
|
if _, ok := userField["accountId"].(string); ok {
|
||||||
|
// this field is already GDPR ready
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
queryName, ok := userField["displayName"].(string)
|
||||||
|
if !ok {
|
||||||
|
queryName, ok = userField["emailAddress"].(string)
|
||||||
|
if !ok {
|
||||||
|
// no fields to search on, skip user lookup
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
users, err := jira.UserSearch(ua, endpoint, &jira.UserSearchOptions{
|
||||||
|
// Query field will search users displayName and emailAddress
|
||||||
|
Query: queryName,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if len(users) != 1 {
|
||||||
|
return fmt.Errorf("Found %d accounts for users with query %q", len(users), queryName)
|
||||||
|
}
|
||||||
|
userField["accountId"] = users[0].AccountID
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func fixGDPRUserFields(ua jira.HttpClient, endpoint string, meta jiradata.FieldMetaMap, fields map[string]interface{}) error {
|
||||||
|
for fieldName, fieldMeta := range meta {
|
||||||
|
// check to see if meta-field is in fields data, otherwise skip
|
||||||
|
if _, ok := fields[fieldName]; !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if fieldMeta.Schema.Type == "user" {
|
||||||
|
userField, ok := fields[fieldName].(map[string]interface{})
|
||||||
|
if !ok {
|
||||||
|
// for some reason the field seems to be the wrong type in the data
|
||||||
|
// even though the schema is a "user"
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
err := fixUserField(ua, endpoint, userField)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fields[fieldName] = userField
|
||||||
|
}
|
||||||
|
if fieldMeta.Schema.Type == "array" && fieldMeta.Schema.Items == "user" {
|
||||||
|
listUserField, ok := fields[fieldName].([]interface{})
|
||||||
|
if !ok {
|
||||||
|
// for some reason the field seems to be the wrong type in the data
|
||||||
|
// even though the schema is a list of "user"
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for i, userFieldItem := range listUserField {
|
||||||
|
userField, ok := userFieldItem.(map[string]interface{})
|
||||||
|
if !ok {
|
||||||
|
// for some reason the field seems to be the wrong type in the data
|
||||||
|
// even though the schema is a "user"
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
err := fixUserField(ua, endpoint, userField)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
listUserField[i] = userField
|
||||||
|
}
|
||||||
|
fields[fieldName] = listUserField
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|||||||
+7
-4
@@ -3,13 +3,14 @@ package jiracmd
|
|||||||
import (
|
import (
|
||||||
"github.com/coryb/figtree"
|
"github.com/coryb/figtree"
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
"github.com/go-jira/jira"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,6 +29,7 @@ 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)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -36,17 +38,18 @@ func CmdEditMetaRegistry() *jiracli.CommandRegistryEntry {
|
|||||||
func CmdEditMetaUsage(cmd *kingpin.CmdClause, opts *EditMetaOptions) error {
|
func CmdEditMetaUsage(cmd *kingpin.CmdClause, opts *EditMetaOptions) error {
|
||||||
jiracli.BrowseUsage(cmd, &opts.CommonOptions)
|
jiracli.BrowseUsage(cmd, &opts.CommonOptions)
|
||||||
jiracli.TemplateUsage(cmd, &opts.CommonOptions)
|
jiracli.TemplateUsage(cmd, &opts.CommonOptions)
|
||||||
|
jiracli.GJsonQueryUsage(cmd, &opts.CommonOptions)
|
||||||
cmd.Arg("ISSUE", "edit metadata for issue id").Required().StringVar(&opts.Issue)
|
cmd.Arg("ISSUE", "edit metadata for issue id").Required().StringVar(&opts.Issue)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// EditMeta will get issue edit metadata and send to "editmeta" template
|
// CmdEditMeta will get issue edit metadata and send to "editmeta" template
|
||||||
func CmdEditMeta(o *oreo.Client, globals *jiracli.GlobalOptions, opts *EditMetaOptions) error {
|
func CmdEditMeta(o *oreo.Client, globals *jiracli.GlobalOptions, opts *EditMetaOptions) error {
|
||||||
editMeta, err := jira.GetIssueEditMeta(o, globals.Endpoint.Value, opts.Issue)
|
editMeta, err := jira.GetIssueEditMeta(o, globals.Endpoint.Value, opts.Issue)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := jiracli.RunTemplate(opts.Template.Value, editMeta, nil); err != nil {
|
if err := opts.PrintTemplate(editMeta); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if opts.Browse.Value {
|
if opts.Browse.Value {
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package jiracmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/coryb/figtree"
|
||||||
|
"github.com/coryb/oreo"
|
||||||
|
|
||||||
|
"github.com/go-jira/jira"
|
||||||
|
"github.com/go-jira/jira/jiracli"
|
||||||
|
"github.com/go-jira/jira/jiradata"
|
||||||
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
type EpicAddOptions struct {
|
||||||
|
jiradata.EpicIssues `yaml:",inline" json:",inline" figtree:",inline"`
|
||||||
|
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||||
|
Epic string `yaml:"epic,omitempty" json:"epic,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func CmdEpicAddRegistry() *jiracli.CommandRegistryEntry {
|
||||||
|
opts := EpicAddOptions{}
|
||||||
|
|
||||||
|
return &jiracli.CommandRegistryEntry{
|
||||||
|
"Add issues to Epic",
|
||||||
|
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
|
||||||
|
jiracli.LoadConfigs(cmd, fig, &opts)
|
||||||
|
return CmdEpicAddUsage(cmd, &opts)
|
||||||
|
},
|
||||||
|
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||||
|
opts.Epic = jiracli.FormatIssue(opts.Epic, opts.Project)
|
||||||
|
for i := range opts.Issues {
|
||||||
|
opts.Issues[i] = jiracli.FormatIssue(opts.Issues[i], opts.Project)
|
||||||
|
}
|
||||||
|
return CmdEpicAdd(o, globals, &opts)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func CmdEpicAddUsage(cmd *kingpin.CmdClause, opts *EpicAddOptions) error {
|
||||||
|
cmd.Arg("EPIC", "Epic Key or ID to add issues to").Required().StringVar(&opts.Epic)
|
||||||
|
cmd.Arg("ISSUE", "Issues to add to epic").Required().StringsVar(&opts.Issues)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func CmdEpicAdd(o *oreo.Client, globals *jiracli.GlobalOptions, opts *EpicAddOptions) error {
|
||||||
|
if err := jira.EpicAddIssues(o, globals.Endpoint.Value, opts.Epic, &opts.EpicIssues); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if !globals.Quiet.Value {
|
||||||
|
fmt.Printf("OK %s %s\n", opts.Epic, jira.URLJoin(globals.Endpoint.Value, "browse", opts.Epic))
|
||||||
|
for _, issue := range opts.Issues {
|
||||||
|
fmt.Printf("OK %s %s\n", issue, jira.URLJoin(globals.Endpoint.Value, "browse", issue))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package jiracmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/coryb/figtree"
|
||||||
|
"github.com/coryb/oreo"
|
||||||
|
|
||||||
|
"github.com/go-jira/jira/jiracli"
|
||||||
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func CmdEpicCreateRegistry() *jiracli.CommandRegistryEntry {
|
||||||
|
opts := CreateOptions{
|
||||||
|
CommonOptions: jiracli.CommonOptions{
|
||||||
|
Template: figtree.NewStringOption("epic-create"),
|
||||||
|
},
|
||||||
|
Overrides: map[string]string{},
|
||||||
|
}
|
||||||
|
|
||||||
|
return &jiracli.CommandRegistryEntry{
|
||||||
|
"Create Epic",
|
||||||
|
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
|
||||||
|
jiracli.LoadConfigs(cmd, fig, &opts)
|
||||||
|
return CmdEpicCreateUsage(cmd, &opts)
|
||||||
|
},
|
||||||
|
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||||
|
return CmdCreate(o, globals, &opts)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func CmdEpicCreateUsage(cmd *kingpin.CmdClause, opts *CreateOptions) error {
|
||||||
|
jiracli.BrowseUsage(cmd, &opts.CommonOptions)
|
||||||
|
jiracli.EditorUsage(cmd, &opts.CommonOptions)
|
||||||
|
jiracli.TemplateUsage(cmd, &opts.CommonOptions)
|
||||||
|
cmd.Flag("noedit", "Disable opening the editor").SetValue(&opts.SkipEditing)
|
||||||
|
cmd.Flag("project", "project to create epic in").Short('p').StringVar(&opts.Project)
|
||||||
|
cmd.Flag("epic-name", "Epic Name").Short('n').PreAction(func(ctx *kingpin.ParseContext) error {
|
||||||
|
opts.Overrides["epic-name"] = jiracli.FlagValue(ctx, "epic-name")
|
||||||
|
return nil
|
||||||
|
}).String()
|
||||||
|
cmd.Flag("comment", "Comment message for epic").Short('m').PreAction(func(ctx *kingpin.ParseContext) error {
|
||||||
|
opts.Overrides["comment"] = jiracli.FlagValue(ctx, "comment")
|
||||||
|
return nil
|
||||||
|
}).String()
|
||||||
|
cmd.Flag("override", "Set epic property").Short('o').StringMapVar(&opts.Overrides)
|
||||||
|
cmd.Flag("saveFile", "Write epic as yaml to file").StringVar(&opts.SaveFile)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package jiracmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/coryb/figtree"
|
||||||
|
"github.com/coryb/oreo"
|
||||||
|
"github.com/go-jira/jira"
|
||||||
|
"github.com/go-jira/jira/jiracli"
|
||||||
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
type EpicListOptions struct {
|
||||||
|
ListOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||||
|
Epic string `yaml:"epic,omitempty" json:"epic,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func CmdEpicListRegistry() *jiracli.CommandRegistryEntry {
|
||||||
|
opts := EpicListOptions{
|
||||||
|
ListOptions: ListOptions{
|
||||||
|
CommonOptions: jiracli.CommonOptions{
|
||||||
|
Template: figtree.NewStringOption("epic-list"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return &jiracli.CommandRegistryEntry{
|
||||||
|
"Prints list of issues for an epic with optional search criteria",
|
||||||
|
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
|
||||||
|
jiracli.LoadConfigs(cmd, fig, &opts)
|
||||||
|
return CmdEpicListUsage(cmd, &opts, fig)
|
||||||
|
},
|
||||||
|
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||||
|
opts.Epic = jiracli.FormatIssue(opts.Epic, opts.Project)
|
||||||
|
if opts.MaxResults == 0 {
|
||||||
|
opts.MaxResults = 500
|
||||||
|
}
|
||||||
|
if opts.QueryFields == "" {
|
||||||
|
opts.QueryFields = "assignee,created,priority,reporter,status,summary,updated,issuetype"
|
||||||
|
}
|
||||||
|
if opts.Sort == "" {
|
||||||
|
opts.Sort = "priority asc, key"
|
||||||
|
}
|
||||||
|
return CmdEpicList(o, globals, &opts)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func CmdEpicListUsage(cmd *kingpin.CmdClause, opts *EpicListOptions, fig *figtree.FigTree) error {
|
||||||
|
CmdListUsage(cmd, &opts.ListOptions, fig)
|
||||||
|
cmd.Arg("EPIC", "Epic Key or ID to list").Required().StringVar(&opts.Epic)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func CmdEpicList(o *oreo.Client, globals *jiracli.GlobalOptions, opts *EpicListOptions) error {
|
||||||
|
data, err := jira.EpicSearch(o, globals.Endpoint.Value, opts.Epic, opts)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return opts.PrintTemplate(data)
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package jiracmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/coryb/figtree"
|
||||||
|
"github.com/coryb/oreo"
|
||||||
|
|
||||||
|
"github.com/go-jira/jira"
|
||||||
|
"github.com/go-jira/jira/jiracli"
|
||||||
|
"github.com/go-jira/jira/jiradata"
|
||||||
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
type EpicRemoveOptions struct {
|
||||||
|
jiradata.EpicIssues `yaml:",inline" json:",inline" figtree:",inline"`
|
||||||
|
Project string `yaml:"project,omitempty" json:"project,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func CmdEpicRemoveRegistry() *jiracli.CommandRegistryEntry {
|
||||||
|
opts := EpicRemoveOptions{}
|
||||||
|
|
||||||
|
return &jiracli.CommandRegistryEntry{
|
||||||
|
"Remove issues from Epic",
|
||||||
|
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
|
||||||
|
jiracli.LoadConfigs(cmd, fig, &opts)
|
||||||
|
return CmdEpicRemoveUsage(cmd, &opts)
|
||||||
|
},
|
||||||
|
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||||
|
for i := range opts.Issues {
|
||||||
|
opts.Issues[i] = jiracli.FormatIssue(opts.Issues[i], opts.Project)
|
||||||
|
}
|
||||||
|
return CmdEpicRemove(o, globals, &opts)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func CmdEpicRemoveUsage(cmd *kingpin.CmdClause, opts *EpicRemoveOptions) error {
|
||||||
|
cmd.Arg("ISSUE", "Issues to remove from any epic").Required().StringsVar(&opts.Issues)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func CmdEpicRemove(o *oreo.Client, globals *jiracli.GlobalOptions, opts *EpicRemoveOptions) error {
|
||||||
|
if err := jira.EpicRemoveIssues(o, globals.Endpoint.Value, &opts.EpicIssues); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if !globals.Quiet.Value {
|
||||||
|
for _, issue := range opts.Issues {
|
||||||
|
fmt.Printf("OK %s %s\n", issue, jira.URLJoin(globals.Endpoint.Value, "browse", issue))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
|
|
||||||
"github.com/coryb/figtree"
|
"github.com/coryb/figtree"
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
"github.com/go-jira/jira/jiracli"
|
||||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -23,12 +23,12 @@ func CmdExportTemplatesRegistry() *jiracli.CommandRegistryEntry {
|
|||||||
"Export templates for customizations",
|
"Export templates for customizations",
|
||||||
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
|
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
|
||||||
jiracli.LoadConfigs(cmd, fig, &opts)
|
jiracli.LoadConfigs(cmd, fig, &opts)
|
||||||
if opts.Dir == "" {
|
|
||||||
opts.Dir = fmt.Sprintf("%s/.jira.d/templates", jiracli.Homedir())
|
|
||||||
}
|
|
||||||
return CmdExportTemplatesUsage(cmd, &opts)
|
return CmdExportTemplatesUsage(cmd, &opts)
|
||||||
},
|
},
|
||||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||||
|
if opts.Dir == "" {
|
||||||
|
opts.Dir = fmt.Sprintf("%s/.jira.d/templates", jiracli.Homedir())
|
||||||
|
}
|
||||||
return CmdExportTemplates(globals, &opts)
|
return CmdExportTemplates(globals, &opts)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-3
@@ -3,8 +3,8 @@ package jiracmd
|
|||||||
import (
|
import (
|
||||||
"github.com/coryb/figtree"
|
"github.com/coryb/figtree"
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
"github.com/go-jira/jira"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
"github.com/go-jira/jira/jiracli"
|
||||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -17,6 +17,7 @@ func CmdFieldsRegistry() *jiracli.CommandRegistryEntry {
|
|||||||
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
|
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
|
||||||
jiracli.LoadConfigs(cmd, fig, &opts)
|
jiracli.LoadConfigs(cmd, fig, &opts)
|
||||||
jiracli.TemplateUsage(cmd, &opts)
|
jiracli.TemplateUsage(cmd, &opts)
|
||||||
|
jiracli.GJsonQueryUsage(cmd, &opts)
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||||
@@ -31,5 +32,5 @@ func CmdFields(o *oreo.Client, globals *jiracli.GlobalOptions, opts *jiracli.Com
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return jiracli.RunTemplate(opts.Template.Value, data, nil)
|
return opts.PrintTemplate(data)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import (
|
|||||||
"github.com/coryb/figtree"
|
"github.com/coryb/figtree"
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
|
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
"github.com/go-jira/jira"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
"github.com/go-jira/jira/jiracli"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
"github.com/go-jira/jira/jiradata"
|
||||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -16,6 +16,7 @@ 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 {
|
||||||
@@ -33,6 +34,8 @@ 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)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -54,7 +57,7 @@ func CmdIssueLinkUsage(cmd *kingpin.CmdClause, opts *IssueLinkOptions) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// CmdBlock will update the given issue as being a duplicate by the given dup issue
|
// CmdIssueLink will update the given issue as being a duplicate by the given dup issue
|
||||||
// and will attempt to resolve the dup issue
|
// and will attempt to resolve the dup issue
|
||||||
func CmdIssueLink(o *oreo.Client, globals *jiracli.GlobalOptions, opts *IssueLinkOptions) error {
|
func CmdIssueLink(o *oreo.Client, globals *jiracli.GlobalOptions, opts *IssueLinkOptions) error {
|
||||||
if err := jira.LinkIssues(o, globals.Endpoint.Value, &opts.LinkIssueRequest); err != nil {
|
if err := jira.LinkIssues(o, globals.Endpoint.Value, &opts.LinkIssueRequest); err != nil {
|
||||||
@@ -62,8 +65,8 @@ func CmdIssueLink(o *oreo.Client, globals *jiracli.GlobalOptions, opts *IssueLin
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !globals.Quiet.Value {
|
if !globals.Quiet.Value {
|
||||||
fmt.Printf("OK %s %s/browse/%s\n", opts.InwardIssue.Key, globals.Endpoint.Value, opts.InwardIssue.Key)
|
fmt.Printf("OK %s %s\n", opts.InwardIssue.Key, jira.URLJoin(globals.Endpoint.Value, "browse", opts.InwardIssue.Key))
|
||||||
fmt.Printf("OK %s %s/browse/%s\n", opts.OutwardIssue.Key, globals.Endpoint.Value, opts.OutwardIssue.Key)
|
fmt.Printf("OK %s %s\n", opts.OutwardIssue.Key, jira.URLJoin(globals.Endpoint.Value, "browse", opts.OutwardIssue.Key))
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.Browse.Value {
|
if opts.Browse.Value {
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package jiracmd
|
|||||||
import (
|
import (
|
||||||
"github.com/coryb/figtree"
|
"github.com/coryb/figtree"
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
"github.com/go-jira/jira"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
"github.com/go-jira/jira/jiracli"
|
||||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -27,6 +27,7 @@ func CmdIssueLinkTypesRegistry() *jiracli.CommandRegistryEntry {
|
|||||||
|
|
||||||
func CmdIssueLinkTypesUsage(cmd *kingpin.CmdClause, opts *jiracli.CommonOptions) error {
|
func CmdIssueLinkTypesUsage(cmd *kingpin.CmdClause, opts *jiracli.CommonOptions) error {
|
||||||
jiracli.TemplateUsage(cmd, opts)
|
jiracli.TemplateUsage(cmd, opts)
|
||||||
|
jiracli.GJsonQueryUsage(cmd, opts)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,5 +37,5 @@ func CmdIssueLinkTypes(o *oreo.Client, globals *jiracli.GlobalOptions, opts *jir
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return jiracli.RunTemplate(opts.Template.Value, data, nil)
|
return opts.PrintTemplate(data)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import (
|
|||||||
"github.com/coryb/figtree"
|
"github.com/coryb/figtree"
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
|
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
"github.com/go-jira/jira"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
"github.com/go-jira/jira/jiracli"
|
||||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -37,6 +37,7 @@ func CmdIssueTypesRegistry() *jiracli.CommandRegistryEntry {
|
|||||||
|
|
||||||
func CmdIssueTypesUsage(cmd *kingpin.CmdClause, opts *IssueTypesOptions) error {
|
func CmdIssueTypesUsage(cmd *kingpin.CmdClause, opts *IssueTypesOptions) error {
|
||||||
jiracli.TemplateUsage(cmd, &opts.CommonOptions)
|
jiracli.TemplateUsage(cmd, &opts.CommonOptions)
|
||||||
|
jiracli.GJsonQueryUsage(cmd, &opts.CommonOptions)
|
||||||
cmd.Flag("project", "project to list issueTypes").Short('p').StringVar(&opts.Project)
|
cmd.Flag("project", "project to list issueTypes").Short('p').StringVar(&opts.Project)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@@ -51,5 +52,5 @@ func CmdIssueTypes(o *oreo.Client, globals *jiracli.GlobalOptions, opts *IssueTy
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return jiracli.RunTemplate(opts.Template.Value, data, nil)
|
return opts.PrintTemplate(data)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,14 +6,15 @@ import (
|
|||||||
"github.com/coryb/figtree"
|
"github.com/coryb/figtree"
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
|
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
"github.com/go-jira/jira"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
"github.com/go-jira/jira/jiracli"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/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"`
|
||||||
}
|
}
|
||||||
@@ -27,6 +28,7 @@ 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)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -39,7 +41,7 @@ func CmdLabelsAddUsage(cmd *kingpin.CmdClause, opts *LabelsAddOptions) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// CmdLabels will add labels on a given issue
|
// CmdLabelsAdd will add labels on a given issue
|
||||||
func CmdLabelsAdd(o *oreo.Client, globals *jiracli.GlobalOptions, opts *LabelsAddOptions) error {
|
func CmdLabelsAdd(o *oreo.Client, globals *jiracli.GlobalOptions, opts *LabelsAddOptions) error {
|
||||||
ops := jiradata.FieldOperations{}
|
ops := jiradata.FieldOperations{}
|
||||||
for _, label := range opts.Labels {
|
for _, label := range opts.Labels {
|
||||||
@@ -57,7 +59,7 @@ func CmdLabelsAdd(o *oreo.Client, globals *jiracli.GlobalOptions, opts *LabelsAd
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if !globals.Quiet.Value {
|
if !globals.Quiet.Value {
|
||||||
fmt.Printf("OK %s %s/browse/%s\n", opts.Issue, globals.Endpoint.Value, opts.Issue)
|
fmt.Printf("OK %s %s\n", opts.Issue, jira.URLJoin(globals.Endpoint.Value, "browse", opts.Issue))
|
||||||
}
|
}
|
||||||
if opts.Browse.Value {
|
if opts.Browse.Value {
|
||||||
return CmdBrowse(globals, opts.Issue)
|
return CmdBrowse(globals, opts.Issue)
|
||||||
|
|||||||
@@ -6,14 +6,15 @@ import (
|
|||||||
"github.com/coryb/figtree"
|
"github.com/coryb/figtree"
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
|
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
"github.com/go-jira/jira"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
"github.com/go-jira/jira/jiracli"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/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"`
|
||||||
}
|
}
|
||||||
@@ -27,6 +28,7 @@ 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)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -39,7 +41,7 @@ func CmdLabelsRemoveUsage(cmd *kingpin.CmdClause, opts *LabelsRemoveOptions) err
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// CmdLabels will remove labels on a given issue
|
// CmdLabelsRemove will remove labels on a given issue
|
||||||
func CmdLabelsRemove(o *oreo.Client, globals *jiracli.GlobalOptions, opts *LabelsRemoveOptions) error {
|
func CmdLabelsRemove(o *oreo.Client, globals *jiracli.GlobalOptions, opts *LabelsRemoveOptions) error {
|
||||||
ops := jiradata.FieldOperations{}
|
ops := jiradata.FieldOperations{}
|
||||||
for _, label := range opts.Labels {
|
for _, label := range opts.Labels {
|
||||||
@@ -58,7 +60,7 @@ func CmdLabelsRemove(o *oreo.Client, globals *jiracli.GlobalOptions, opts *Label
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if !globals.Quiet.Value {
|
if !globals.Quiet.Value {
|
||||||
fmt.Printf("OK %s %s/browse/%s\n", opts.Issue, globals.Endpoint.Value, opts.Issue)
|
fmt.Printf("OK %s %s\n", opts.Issue, jira.URLJoin(globals.Endpoint.Value, "browse", opts.Issue))
|
||||||
}
|
}
|
||||||
if opts.Browse.Value {
|
if opts.Browse.Value {
|
||||||
return CmdBrowse(globals, opts.Issue)
|
return CmdBrowse(globals, opts.Issue)
|
||||||
|
|||||||
@@ -6,14 +6,15 @@ import (
|
|||||||
"github.com/coryb/figtree"
|
"github.com/coryb/figtree"
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
|
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
"github.com/go-jira/jira"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
"github.com/go-jira/jira/jiracli"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/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"`
|
||||||
}
|
}
|
||||||
@@ -27,6 +28,7 @@ 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)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -39,7 +41,7 @@ func CmdLabelsSetUsage(cmd *kingpin.CmdClause, opts *LabelsSetOptions) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// CmdLabels will set labels on a given issue
|
// CmdLabelsSet will set labels on a given issue
|
||||||
func CmdLabelsSet(o *oreo.Client, globals *jiracli.GlobalOptions, opts *LabelsSetOptions) error {
|
func CmdLabelsSet(o *oreo.Client, globals *jiracli.GlobalOptions, opts *LabelsSetOptions) error {
|
||||||
issueUpdate := jiradata.IssueUpdate{
|
issueUpdate := jiradata.IssueUpdate{
|
||||||
Update: jiradata.FieldOperationsMap{
|
Update: jiradata.FieldOperationsMap{
|
||||||
@@ -55,7 +57,7 @@ func CmdLabelsSet(o *oreo.Client, globals *jiracli.GlobalOptions, opts *LabelsSe
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if !globals.Quiet.Value {
|
if !globals.Quiet.Value {
|
||||||
fmt.Printf("OK %s %s/browse/%s\n", opts.Issue, globals.Endpoint.Value, opts.Issue)
|
fmt.Printf("OK %s %s\n", opts.Issue, jira.URLJoin(globals.Endpoint.Value, "browse", opts.Issue))
|
||||||
}
|
}
|
||||||
if opts.Browse.Value {
|
if opts.Browse.Value {
|
||||||
return CmdBrowse(globals, opts.Issue)
|
return CmdBrowse(globals, opts.Issue)
|
||||||
|
|||||||
+23
-12
@@ -1,16 +1,19 @@
|
|||||||
package jiracmd
|
package jiracmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/coryb/figtree"
|
"github.com/coryb/figtree"
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
"github.com/go-jira/jira"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
"github.com/go-jira/jira/jiracli"
|
||||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ListOptions struct {
|
type ListOptions struct {
|
||||||
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||||
jira.SearchOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
jira.SearchOptions `yaml:",inline" json:",inline" figtree:",inline"`
|
||||||
|
Queries map[string]string `yaml:"queries,omitempty" json:"queries,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func CmdListRegistry() *jiracli.CommandRegistryEntry {
|
func CmdListRegistry() *jiracli.CommandRegistryEntry {
|
||||||
@@ -24,33 +27,41 @@ func CmdListRegistry() *jiracli.CommandRegistryEntry {
|
|||||||
"Prints list of issues for given search criteria",
|
"Prints list of issues for given search criteria",
|
||||||
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
|
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
|
||||||
jiracli.LoadConfigs(cmd, fig, &opts)
|
jiracli.LoadConfigs(cmd, fig, &opts)
|
||||||
if opts.MaxResults == 0 {
|
return CmdListUsage(cmd, &opts, fig)
|
||||||
opts.MaxResults = 500
|
},
|
||||||
}
|
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||||
if opts.QueryFields == "" {
|
if opts.QueryFields == "" {
|
||||||
opts.QueryFields = "assignee,created,priority,reporter,status,summary,updated"
|
opts.QueryFields = "assignee,created,priority,reporter,status,summary,updated,issuetype"
|
||||||
}
|
}
|
||||||
if opts.Sort == "" {
|
if opts.Sort == "" {
|
||||||
opts.Sort = "priority asc, key"
|
opts.Sort = "priority asc, key"
|
||||||
}
|
}
|
||||||
return CmdListUsage(cmd, &opts)
|
|
||||||
},
|
|
||||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
|
||||||
return CmdList(o, globals, &opts)
|
return CmdList(o, globals, &opts)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func CmdListUsage(cmd *kingpin.CmdClause, opts *ListOptions) error {
|
func CmdListUsage(cmd *kingpin.CmdClause, opts *ListOptions, fig *figtree.FigTree) error {
|
||||||
jiracli.TemplateUsage(cmd, &opts.CommonOptions)
|
jiracli.TemplateUsage(cmd, &opts.CommonOptions)
|
||||||
|
jiracli.GJsonQueryUsage(cmd, &opts.CommonOptions)
|
||||||
cmd.Flag("assignee", "User assigned the issue").Short('a').StringVar(&opts.Assignee)
|
cmd.Flag("assignee", "User assigned the issue").Short('a').StringVar(&opts.Assignee)
|
||||||
cmd.Flag("component", "Component to search for").Short('c').StringVar(&opts.Component)
|
cmd.Flag("component", "Component to search for").Short('c').StringVar(&opts.Component)
|
||||||
cmd.Flag("issuetype", "Issue type to search for").Short('i').StringVar(&opts.IssueType)
|
cmd.Flag("issuetype", "Issue type to search for").Short('i').StringVar(&opts.IssueType)
|
||||||
cmd.Flag("limit", "Maximum number of results to return in search").Short('l').IntVar(&opts.MaxResults)
|
cmd.Flag("limit", "Maximum number of results to return in search").Short('l').IntVar(&opts.MaxResults)
|
||||||
cmd.Flag("project", "Project to search for").Short('p').StringVar(&opts.Project)
|
cmd.Flag("project", "Project to search for").Short('p').StringVar(&opts.Project)
|
||||||
|
cmd.Flag("named-query", "The name of a query in the `queries` configuration").Short('n').PreAction(func(ctx *kingpin.ParseContext) error {
|
||||||
|
name := jiracli.FlagValue(ctx, "named-query")
|
||||||
|
if query, ok := opts.Queries[name]; ok && query != "" {
|
||||||
|
var err error
|
||||||
|
opts.Query, err = jiracli.ConfigTemplate(fig, query, cmd.FullCommand(), opts)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return fmt.Errorf("A valid named-query %q not found in `queries` configuration", name)
|
||||||
|
}).String()
|
||||||
cmd.Flag("query", "Jira Query Language (JQL) expression for the search").Short('q').StringVar(&opts.Query)
|
cmd.Flag("query", "Jira Query Language (JQL) expression for the search").Short('q').StringVar(&opts.Query)
|
||||||
cmd.Flag("queryfields", "Fields that are used in \"list\" template").Short('f').StringVar(&opts.QueryFields)
|
cmd.Flag("queryfields", "Fields that are used in \"list\" template").Short('f').StringVar(&opts.QueryFields)
|
||||||
cmd.Flag("reporter", "Reporter to search for").Short('r').StringVar(&opts.Reporter)
|
cmd.Flag("reporter", "Reporter to search for").Short('r').StringVar(&opts.Reporter)
|
||||||
|
cmd.Flag("status", "Filter on issue status").Short('S').StringVar(&opts.Status)
|
||||||
cmd.Flag("sort", "Sort order to return").Short('s').StringVar(&opts.Sort)
|
cmd.Flag("sort", "Sort order to return").Short('s').StringVar(&opts.Sort)
|
||||||
cmd.Flag("watcher", "Watcher to search for").Short('w').StringVar(&opts.Watcher)
|
cmd.Flag("watcher", "Watcher to search for").Short('w').StringVar(&opts.Watcher)
|
||||||
return nil
|
return nil
|
||||||
@@ -58,9 +69,9 @@ func CmdListUsage(cmd *kingpin.CmdClause, opts *ListOptions) error {
|
|||||||
|
|
||||||
// List will query jira and send data to "list" template
|
// List will query jira and send data to "list" template
|
||||||
func CmdList(o *oreo.Client, globals *jiracli.GlobalOptions, opts *ListOptions) error {
|
func CmdList(o *oreo.Client, globals *jiracli.GlobalOptions, opts *ListOptions) error {
|
||||||
data, err := jira.Search(o, globals.Endpoint.Value, opts)
|
data, err := jira.Search(o, globals.Endpoint.Value, opts, jira.WithAutoPagination())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return jiracli.RunTemplate(opts.Template.Value, data, nil)
|
return opts.PrintTemplate(data)
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user