summaryrefslogtreecommitdiffstats
path: root/pkg/commands/pull_request.go
diff options
context:
space:
mode:
authorWilliam Wagner Moraes Artero <williamwmoraes@gmail.com>2019-12-06 13:38:18 +0100
committerJesse Duffield <jessedduffield@gmail.com>2020-03-01 10:57:12 +1100
commitfe5f087f9c29fd6e11429ac5f412a8107ffb902d (patch)
tree1373ee81687f6fd9ba1d43abdecd93cff952bada /pkg/commands/pull_request.go
parent79299be3b23725e4055ca264e6fa0a0c16af430f (diff)
feat: configurable services
Diffstat (limited to 'pkg/commands/pull_request.go')
-rw-r--r--pkg/commands/pull_request.go18
1 files changed, 15 insertions, 3 deletions
diff --git a/pkg/commands/pull_request.go b/pkg/commands/pull_request.go
index 11905f01d..a6b6bc8f7 100644
--- a/pkg/commands/pull_request.go
+++ b/pkg/commands/pull_request.go
@@ -5,6 +5,7 @@ import (
"strings"
"github.com/go-errors/errors"
+ "github.com/jesseduffield/lazygit/pkg/config"
)
// Service is a service that repository is on (Github, Bitbucket, ...)
@@ -26,8 +27,8 @@ type RepoInformation struct {
Repository string
}
-func getServices() []*Service {
- return []*Service{
+func getServices(config config.AppConfigurer) []*Service {
+ services := []*Service{
{
Name: "github.com",
PullRequestURL: "https://github.com/%s/%s/compare/%s?expand=1",
@@ -41,12 +42,23 @@ func getServices() []*Service {
PullRequestURL: "https://gitlab.com/%s/%s/merge_requests/new?merge_request[source_branch]=%s",
},
}
+
+ configServices := config.GetUserConfig().GetStringMapString("services")
+
+ for name, prURL := range configServices {
+ services = append(services, &Service{
+ Name: name,
+ PullRequestURL: prURL,
+ })
+ }
+
+ return services
}
// NewPullRequest creates new instance of PullRequest
func NewPullRequest(gitCommand *GitCommand) *PullRequest {
return &PullRequest{
- GitServices: getServices(),
+ GitServices: getServices(gitCommand.Config),
GitCommand: gitCommand,
}
}