mirror of
https://github.com/Threnklyn/jira.git
synced 2026-05-18 20:23:28 +02:00
update gitter room
This commit is contained in:
@@ -7,3 +7,4 @@ src/github.com/op/
|
||||
src/gopkg.in/
|
||||
jira
|
||||
jira.exe
|
||||
schemas/*.json
|
||||
@@ -1,4 +1,4 @@
|
||||
[](https://gitter.im/go-jira-cli/Lobby?utm_source=badge&utm_medium=badge&utm_content=badge)
|
||||
[](https://gitter.im/go-jira-cli/help?utm_source=badge&utm_medium=badge&utm_content=badge)
|
||||
|
||||
# go-jira
|
||||
simple command line client for Atlassian's Jira service written in Go
|
||||
|
||||
+25
-1
@@ -2,9 +2,12 @@ package jira
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/howeyc/gopass"
|
||||
"github.com/Netflix-Skunkworks/go-jira/data"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
@@ -261,8 +264,29 @@ func (c *Cli) CmdComponents(project string) error {
|
||||
return runTemplate(c.getTemplate("components"), data, nil)
|
||||
}
|
||||
|
||||
func (c *Cli) ValidTransitions(issue string) (jiradata.Transitions,error) {
|
||||
uri := fmt.Sprintf("%s/rest/api/2/issue/%s/transitions?expand=transitions.fields", c.endpoint, issue)
|
||||
resp, err := c.get(uri)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
transMeta := &jiradata.TransitionsMeta{}
|
||||
content, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = json.Unmarshal(content, transMeta)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return transMeta.Transitions, nil
|
||||
}
|
||||
|
||||
func (c *Cli) CmdTransitions(issue string) error {
|
||||
log.Debugf("Transitions called")
|
||||
// FIXME this should just call ValidTransitions then pass that data to templates
|
||||
c.Browse(issue)
|
||||
uri := fmt.Sprintf("%s/rest/api/2/issue/%s/transitions", c.endpoint, issue)
|
||||
data, err := responseToJson(c.get(uri))
|
||||
@@ -565,7 +589,7 @@ func (c *Cli) CmdTransition(issue string, trans string) error {
|
||||
}
|
||||
if transId == "" {
|
||||
err := fmt.Errorf("Invalid Transition '%s', Available: %s", trans, strings.Join(found, ", "))
|
||||
log.Errorf("%s", err)
|
||||
log.Debugf("%s", err)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -371,7 +371,18 @@ Command Options:
|
||||
requireArgs(2)
|
||||
if err = c.CmdDups(args[0], args[1]); err == nil {
|
||||
opts["resolution"] = "Duplicate"
|
||||
trans, err := c.ValidTransitions(args[0])
|
||||
if err == nil {
|
||||
close := trans.Find("close")
|
||||
if close != nil {
|
||||
err = c.CmdTransition(args[0], "close")
|
||||
} else {
|
||||
// for now just assume if there is no "close", then
|
||||
// there is a "done" state
|
||||
err = c.CmdTransition(args[0], "done")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
case "watch":
|
||||
requireArgs(1)
|
||||
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python
|
||||
from lxml import html
|
||||
import requests
|
||||
import json
|
||||
|
||||
page = requests.get('https://docs.atlassian.com/jira/REST/cloud')
|
||||
tree = html.fromstring(page.content)
|
||||
|
||||
schemas = tree.xpath("//div[@class='representation-doc-block']//code/text()")
|
||||
|
||||
for schema in schemas:
|
||||
try:
|
||||
data = json.loads(schema)
|
||||
if "title" in data:
|
||||
title = data["title"].replace(" ", "")
|
||||
print "Writing {}.json".format(title)
|
||||
with open("{}.json".format(title), 'w') as f:
|
||||
f.write(schema)
|
||||
except:
|
||||
True
|
||||
|
||||
+5
-1
@@ -3,7 +3,7 @@ eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)"
|
||||
cd $(dirname $0)
|
||||
jira="../jira --user admin"
|
||||
|
||||
PLAN 13
|
||||
PLAN 14
|
||||
|
||||
# clean out any old containers
|
||||
RUNS sh -c "docker rm -f go-jira-test || true"
|
||||
@@ -42,3 +42,7 @@ RUNS $jira req -M POST /rest/api/2/project '{"key":"PROCESS","name":"Process","p
|
||||
RUNS $jira req -M POST /rest/api/2/project '{"key":"TASK","name":"Task","projectTypeKey":"business","projectTemplateKey":"com.atlassian.jira-core-project-templates:jira-core-task-management","lead":"gojira"}'
|
||||
|
||||
RUNS $jira logout
|
||||
|
||||
# export new templates so we are always using whatever is latest
|
||||
# and not whatever is in the test-runners homedir
|
||||
RUNS $jira export-templates -d .jira.d/templates
|
||||
|
||||
Reference in New Issue
Block a user