add more issue / pr creation params #331
|
@ -62,12 +62,13 @@ func CreateIssue(login *config.Login, owner, repo string) error {
|
||||||
}
|
}
|
||||||
// check for custom value & prompt again with text input
|
// check for custom value & prompt again with text input
|
||||||
// HACK until https://github.com/AlecAivazis/survey/issues/339 is implemented
|
// HACK until https://github.com/AlecAivazis/survey/issues/339 is implemented
|
||||||
if utils.Contains(assignees, customVal) {
|
if otherIndex := utils.IndexOf(assignees, customVal); otherIndex != -1 {
|
||||||
var customAssignees string
|
var customAssignees string
|
||||||
promptA := &survey.Input{Message: "Assignees:", Help: "comma separated usernames"}
|
promptA := &survey.Input{Message: "Assignees:", Help: "comma separated usernames"}
|
||||||
if err := survey.AskOne(promptA, &customAssignees); err != nil {
|
if err := survey.AskOne(promptA, &customAssignees); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
assignees = append(assignees[:otherIndex], assignees[otherIndex+1:]...)
|
||||||
assignees = append(assignees, strings.Split(customAssignees, ",")...)
|
assignees = append(assignees, strings.Split(customAssignees, ",")...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,15 @@ package utils
|
||||||
|
|
||||||
// Contains checks containment
|
// Contains checks containment
|
||||||
func Contains(haystack []string, needle string) bool {
|
func Contains(haystack []string, needle string) bool {
|
||||||
for _, s := range haystack {
|
return IndexOf(haystack, needle) != -1
|
||||||
|
}
|
||||||
|
|
||||||
|
// IndexOf returns the index of first occurence of needle in haystack
|
||||||
|
func IndexOf(haystack []string, needle string) int {
|
||||||
|
for i, s := range haystack {
|
||||||
if s == needle {
|
if s == needle {
|
||||||
return true
|
return i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return -1
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user