mirror of
https://github.com/Threnklyn/jira.git
synced 2026-06-07 13:33:32 +02:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| adc08935b4 | |||
| 073c8a3694 | |||
| c4a31a498e | |||
| bcad37089a | |||
| b2ba8de15d | |||
| 6016bda571 | |||
| 34ca09cf1a | |||
| d7fb88ee41 | |||
| e58625b00c |
@@ -1,5 +1,14 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 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
|
## 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)]
|
* 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)]
|
||||||
|
|||||||
@@ -1,18 +1,19 @@
|
|||||||
PLATFORMS= \
|
PLATFORMS= \
|
||||||
freebsd-386 \
|
|
||||||
freebsd-amd64 \
|
freebsd-amd64 \
|
||||||
freebsd-arm \
|
|
||||||
linux-386 \
|
linux-386 \
|
||||||
linux-amd64 \
|
linux-amd64 \
|
||||||
linux-arm \
|
|
||||||
openbsd-386 \
|
|
||||||
openbsd-amd64 \
|
|
||||||
windows-386 \
|
windows-386 \
|
||||||
windows-amd64 \
|
windows-amd64 \
|
||||||
darwin-386 \
|
|
||||||
darwin-amd64 \
|
darwin-amd64 \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
# freebsd-386 \
|
||||||
|
# freebsd-arm \
|
||||||
|
# linux-arm \
|
||||||
|
# openbsd-386 \
|
||||||
|
# openbsd-amd64 \
|
||||||
|
# darwin-386
|
||||||
|
|
||||||
NAME=jira
|
NAME=jira
|
||||||
|
|
||||||
OS=$(shell uname -s)
|
OS=$(shell uname -s)
|
||||||
@@ -33,8 +34,8 @@ DIST=$(CWD)$(SEP)dist
|
|||||||
|
|
||||||
GOBIN ?= $(CWD)
|
GOBIN ?= $(CWD)
|
||||||
|
|
||||||
CURVER ?= $(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:=-X jira.VERSION=$(patsubst v%,%,$(CURVER)) -w
|
LDFLAGS:=-X jira.VERSION=$(CURVER) -w
|
||||||
|
|
||||||
# use make DEBUG=1 and you can get a debuggable golang binary
|
# use make DEBUG=1 and you can get a debuggable golang binary
|
||||||
# see https://github.com/mailgun/godebug
|
# see https://github.com/mailgun/godebug
|
||||||
@@ -65,6 +66,7 @@ all:
|
|||||||
echo "Building for $$p"; \
|
echo "Building for $$p"; \
|
||||||
${MAKE} build GOOS=$${p/-*/} GOARCH=$${p/*-/} BIN=$(DIST)/$(NAME)-$$p; \
|
${MAKE} build GOOS=$${p/-*/} GOARCH=$${p/*-/} BIN=$(DIST)/$(NAME)-$$p; \
|
||||||
done
|
done
|
||||||
|
for x in $(DIST)/jira-windows-*; do mv $$x $$x.exe; done
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
gofmt -s -w main/*.go *.go
|
gofmt -s -w main/*.go *.go
|
||||||
@@ -76,7 +78,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 ^$(CURVER) HEAD main/*.go *.go | grep -vE 'gofmt|go fmt'
|
@git log --pretty=format:"* %s [%cn] [%h]" --no-merges ^v$(CURVER) HEAD main/*.go *.go | grep -vE 'gofmt|go fmt'
|
||||||
|
|
||||||
update-changelog:
|
update-changelog:
|
||||||
@echo "# Changelog" > CHANGELOG.md.new; \
|
@echo "# Changelog" > CHANGELOG.md.new; \
|
||||||
@@ -92,7 +94,7 @@ update-changelog:
|
|||||||
git tag v$(NEWVER)
|
git tag v$(NEWVER)
|
||||||
|
|
||||||
version:
|
version:
|
||||||
@echo $(patsubst v%,%,$(CURVER))
|
@echo $(CURVER)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf pkg dist bin src ./$(NAME)
|
rm -rf pkg dist bin src ./$(NAME)
|
||||||
|
|||||||
@@ -157,6 +157,26 @@ When running a command like `jira edit` it will look through the current directo
|
|||||||
if found it will use that file as the template, otherwise it will use the default **edit** template hard-coded into **go-jira**. You can export the default
|
if found it will use that file as the template, otherwise it will use the default **edit** template hard-coded into **go-jira**. You can export the default
|
||||||
hard-coded templates with `jira export-templates` which will write them to **~/.jira.d/templates/**.
|
hard-coded templates with `jira export-templates` which will write them to **~/.jira.d/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/util.go#L133).
|
||||||
|
|
||||||
|
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:
|
||||||
|
```
|
||||||
|
jira view GOJIRA-321 -t debug
|
||||||
|
```
|
||||||
|
|
||||||
|
This will print out the data in JSON format that is available to the template. You can do this for any other operation, like "list":
|
||||||
|
```
|
||||||
|
jira list -t debug
|
||||||
|
```
|
||||||
|
|
||||||
|
Figuring out what is available to input templates (like for the `create` operation) is a bit more tricky, but similar. To find the data available for a `create` template you can run:
|
||||||
|
```
|
||||||
|
jira create --dryrun -t debug --editor /bin/cat
|
||||||
|
```
|
||||||
|
This will attempt to fetch metadata for your default project (you can provide any options that you would normally specify for the `create` operation). It uses the `--dryrun` option to prevent any actual updates being sent to Jira. The `-t debug` is like before to cause the input to be serialized to JSON and printed for your inspection. Finally the `--editor /bin/cat` will cause `go-jira` to just print the template rather than open up an editor and wait for you to edit/save it.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -261,13 +261,25 @@ func (c *Cli) editTemplate(template string, tmpFilePrefix string, templateData m
|
|||||||
log.Errorf("Failed to make temp file in %s: %s", tmpdir, err)
|
log.Errorf("Failed to make temp file in %s: %s", tmpdir, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer fh.Close()
|
|
||||||
|
|
||||||
tmpFileName := fmt.Sprintf("%s.yml", fh.Name())
|
oldFileName := fh.Name()
|
||||||
if err := os.Rename(fh.Name(), tmpFileName); err != nil {
|
tmpFileName := fmt.Sprintf("%s.yml", oldFileName)
|
||||||
log.Errorf("Failed to rename %s to %s: %s", fh.Name(), fmt.Sprintf("%s.yml", fh.Name()), err)
|
|
||||||
|
// close tmpfile so we can rename on windows
|
||||||
|
fh.Close()
|
||||||
|
|
||||||
|
if err := os.Rename(oldFileName, tmpFileName); err != nil {
|
||||||
|
log.Errorf("Failed to rename %s to %s: %s", oldFileName, tmpFileName, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fh, err = os.OpenFile(tmpFileName, os.O_RDWR|os.O_EXCL, 0600)
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("Failed to reopen temp file file in %s: %s", tmpFileName, err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
defer fh.Close()
|
||||||
defer func() {
|
defer func() {
|
||||||
os.Remove(tmpFileName)
|
os.Remove(tmpFileName)
|
||||||
}()
|
}()
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ Usage:
|
|||||||
jira reopen ISSUE [--edit] <Edit Options>
|
jira reopen ISSUE [--edit] <Edit Options>
|
||||||
jira start ISSUE [--edit] <Edit Options>
|
jira start ISSUE [--edit] <Edit Options>
|
||||||
jira stop ISSUE [--edit] <Edit Options>
|
jira stop ISSUE [--edit] <Edit Options>
|
||||||
|
jira todo ISSUE [--edit] <Edit Options>
|
||||||
|
jira done ISSUE [--edit] <Edit Options>
|
||||||
|
jira prog|progress|in-progress [--edit] <Edit Options>
|
||||||
jira comment ISSUE [--noedit] <Edit Options>
|
jira comment ISSUE [--noedit] <Edit Options>
|
||||||
jira (set,add,remove) labels ISSUE [LABEL] ...
|
jira (set,add,remove) labels ISSUE [LABEL] ...
|
||||||
jira take ISSUE
|
jira take ISSUE
|
||||||
@@ -140,6 +143,11 @@ Command Options:
|
|||||||
"reopen": "reopen",
|
"reopen": "reopen",
|
||||||
"start": "start",
|
"start": "start",
|
||||||
"stop": "stop",
|
"stop": "stop",
|
||||||
|
"todo": "todo",
|
||||||
|
"done": "done",
|
||||||
|
"prog": "in-progress",
|
||||||
|
"progress": "in-progress",
|
||||||
|
"in-progress": "in-progress",
|
||||||
"comment": "comment",
|
"comment": "comment",
|
||||||
"label": "labels",
|
"label": "labels",
|
||||||
"labels": "labels",
|
"labels": "labels",
|
||||||
@@ -390,6 +398,18 @@ Command Options:
|
|||||||
requireArgs(1)
|
requireArgs(1)
|
||||||
setEditing(false)
|
setEditing(false)
|
||||||
err = c.CmdTransition(args[0], "stop")
|
err = c.CmdTransition(args[0], "stop")
|
||||||
|
case "todo":
|
||||||
|
requireArgs(1)
|
||||||
|
setEditing(false)
|
||||||
|
err = c.CmdTransition(args[0], "To Do")
|
||||||
|
case "done":
|
||||||
|
requireArgs(1)
|
||||||
|
setEditing(false)
|
||||||
|
err = c.CmdTransition(args[0], "Done")
|
||||||
|
case "in-progress":
|
||||||
|
requireArgs(1)
|
||||||
|
setEditing(false)
|
||||||
|
err = c.CmdTransition(args[0], "In Progress")
|
||||||
case "comment":
|
case "comment":
|
||||||
requireArgs(1)
|
requireArgs(1)
|
||||||
setEditing(true)
|
setEditing(true)
|
||||||
|
|||||||
+2
-2
@@ -65,8 +65,8 @@ fields:
|
|||||||
- name: {{ .name }}{{end}}{{end}}
|
- name: {{ .name }}{{end}}{{end}}
|
||||||
assignee:
|
assignee:
|
||||||
name: {{ if .overrides.assignee }}{{.overrides.assignee}}{{else}}{{if .fields.assignee }}{{ .fields.assignee.name }}{{end}}{{end}}
|
name: {{ if .overrides.assignee }}{{.overrides.assignee}}{{else}}{{if .fields.assignee }}{{ .fields.assignee.name }}{{end}}{{end}}
|
||||||
reporter:
|
# reporter:
|
||||||
name: {{ if .overrides.reporter }}{{ .overrides.reporter }}{{else if .fields.reporter}}{{ .fields.reporter.name }}{{end}}
|
# name: {{ if .overrides.reporter }}{{ .overrides.reporter }}{{else if .fields.reporter}}{{ .fields.reporter.name }}{{end}}
|
||||||
# watchers
|
# watchers
|
||||||
customfield_10110: {{ range .fields.customfield_10110 }}
|
customfield_10110: {{ range .fields.customfield_10110 }}
|
||||||
- name: {{ .name }}{{end}}{{if .overrides.watcher}}
|
- name: {{ .name }}{{end}}{{if .overrides.watcher}}
|
||||||
|
|||||||
Reference in New Issue
Block a user