From f124df7e73f8613bf9cd2f83177eeb4110c7a639 Mon Sep 17 00:00:00 2001 From: Amine Hilaly Date: Fri, 24 May 2019 21:03:31 +0200 Subject: changes to the BridgeImpl Interface Add bridge params Change bridge.Configure signature --- bridge/core/bridge.go | 13 +++++++++++-- bridge/core/interfaces.go | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'bridge') diff --git a/bridge/core/bridge.go b/bridge/core/bridge.go index aa02ceb5..6bc14bc7 100644 --- a/bridge/core/bridge.go +++ b/bridge/core/bridge.go @@ -20,6 +20,15 @@ const bridgeConfigKeyPrefix = "git-bug.bridge" var bridgeImpl map[string]reflect.Type +// BridgeParams holds parameters to simplify the bridge configuration without +// having to make terminal prompts. +type BridgeParams struct { + Owner string + Project string + URL string + Token string +} + // Bridge is a wrapper around a BridgeImpl that will bind low-level // implementation with utility code to provide high-level functions. type Bridge struct { @@ -166,8 +175,8 @@ func RemoveBridge(repo repository.RepoCommon, fullName string) error { } // Configure run the target specific configuration process -func (b *Bridge) Configure() error { - conf, err := b.impl.Configure(b.repo) +func (b *Bridge) Configure(params BridgeParams) error { + conf, err := b.impl.Configure(b.repo, params) if err != nil { return err } diff --git a/bridge/core/interfaces.go b/bridge/core/interfaces.go index be5afa62..37fdb3d7 100644 --- a/bridge/core/interfaces.go +++ b/bridge/core/interfaces.go @@ -15,7 +15,7 @@ type BridgeImpl interface { // Configure handle the user interaction and return a key/value configuration // for future use - Configure(repo repository.RepoCommon) (Configuration, error) + Configure(repo repository.RepoCommon, params BridgeParams) (Configuration, error) // ValidateConfig check the configuration for error ValidateConfig(conf Configuration) error -- cgit