aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/jira
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-02-09 20:08:12 +0100
committerMichael Muré <batolettre@gmail.com>2020-02-09 20:23:38 +0100
commitb3d3612393387c83fa43f908dbb8e2a71068c834 (patch)
treee4609e21dc74e535d45b38cd7d0504681c544160 /bridge/jira
parentdca85b309a0a82e9993a345964d0831ab2876fb4 (diff)
parent3caffeef4d2ed25d4eb5d4bfd262f4fc3b92561f (diff)
downloadgit-bug-b3d3612393387c83fa43f908dbb8e2a71068c834.tar.gz
Merge remote-tracking branch 'origin/master' into cheshirekow-jira
Diffstat (limited to 'bridge/jira')
-rw-r--r--bridge/jira/client.go2
-rw-r--r--bridge/jira/config.go23
-rw-r--r--bridge/jira/import.go1
-rw-r--r--bridge/jira/jira.go29
4 files changed, 30 insertions, 25 deletions
diff --git a/bridge/jira/client.go b/bridge/jira/client.go
index 040c988e..6ec1c9dd 100644
--- a/bridge/jira/client.go
+++ b/bridge/jira/client.go
@@ -386,7 +386,7 @@ func (client *Client) Login(conf core.Configuration) error {
password := conf[keyPassword]
if password == "" {
var err error
- password, err = input.PromptPassword()
+ password, err = input.PromptPassword("Password", "password", input.Required)
if err != nil {
return err
}
diff --git a/bridge/jira/config.go b/bridge/jira/config.go
index 59076564..406bed31 100644
--- a/bridge/jira/config.go
+++ b/bridge/jira/config.go
@@ -8,7 +8,6 @@ import (
"os"
"strconv"
"strings"
- "time"
"github.com/pkg/errors"
@@ -17,22 +16,6 @@ import (
"github.com/MichaelMure/git-bug/input"
)
-const (
- target = "jira"
- keyServer = "server"
- keyProject = "project"
- keyCredentialsType = "credentials-type"
- keyCredentialsFile = "credentials-file"
- keyUsername = "username"
- keyPassword = "password"
- keyIDMap = "bug-id-map"
- keyIDRevMap = "bug-id-revmap"
- keyCreateDefaults = "create-issue-defaults"
- keyCreateGitBug = "create-issue-gitbug-id"
-
- defaultTimeout = 60 * time.Second
-)
-
const moreConfigText = `
NOTE: There are a few optional configuration values that you can additionally
set in your git configuration to influence the behavior of the bridge. Please
@@ -65,9 +48,7 @@ How would you like to store your JIRA login credentials?
`
// Configure sets up the bridge configuration
-func (g *Jira) Configure(
- repo *cache.RepoCache, params core.BridgeParams) (
- core.Configuration, error) {
+func (g *Jira) Configure(repo *cache.RepoCache, params core.BridgeParams) (core.Configuration, error) {
conf := make(core.Configuration)
var err error
var url string
@@ -126,7 +107,7 @@ func (g *Jira) Configure(
return nil, err
}
- password, err = input.PromptPassword()
+ password, err = input.PromptPassword("Password", "password", input.Required)
if err != nil {
return nil, err
}
diff --git a/bridge/jira/import.go b/bridge/jira/import.go
index 2337d8bd..bc1bf428 100644
--- a/bridge/jira/import.go
+++ b/bridge/jira/import.go
@@ -175,7 +175,6 @@ func (self *jiraImporter) ensurePerson(
user.DisplayName,
user.EmailAddress,
user.Key,
- "",
map[string]string{
keyJiraUser: string(user.Key),
},
diff --git a/bridge/jira/jira.go b/bridge/jira/jira.go
index accb9e7c..43a11c05 100644
--- a/bridge/jira/jira.go
+++ b/bridge/jira/jira.go
@@ -3,10 +3,32 @@ package jira
import (
"sort"
+ "time"
"github.com/MichaelMure/git-bug/bridge/core"
)
+const (
+ target = "jira"
+
+ metaKeyJiraLogin = "jira-login"
+
+ keyServer = "server"
+ keyProject = "project"
+ keyCredentialsType = "credentials-type"
+ keyCredentialsFile = "credentials-file"
+ keyUsername = "username"
+ keyPassword = "password"
+ keyIDMap = "bug-id-map"
+ keyIDRevMap = "bug-id-revmap"
+ keyCreateDefaults = "create-issue-defaults"
+ keyCreateGitBug = "create-issue-gitbug-id"
+
+ defaultTimeout = 60 * time.Second
+)
+
+var _ core.BridgeImpl = &Jira{}
+
// Jira Main object for the bridge
type Jira struct{}
@@ -15,6 +37,10 @@ func (*Jira) Target() string {
return target
}
+func (*Jira) LoginMetaKey() string {
+ return metaKeyJiraLogin
+}
+
// NewImporter returns the jira importer
func (*Jira) NewImporter() core.Importer {
return &jiraImporter{}
@@ -39,8 +65,7 @@ func stringInSlice(needle string, haystack []string) bool {
// 1. elements found only in the first input list
// 2. elements found only in the second input list
// 3. elements found in both input lists
-func setSymmetricDifference(
- setA, setB []string) ([]string, []string, []string) {
+func setSymmetricDifference(setA, setB []string) ([]string, []string, []string) {
sort.Strings(setA)
sort.Strings(setB)