From 74e91144105790cc997c1d79a7f638e1e3a1f3f8 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Fri, 24 Jan 2020 00:30:13 +0100 Subject: more more wip --- bridge/launchpad/import.go | 1 - 1 file changed, 1 deletion(-) (limited to 'bridge/launchpad') diff --git a/bridge/launchpad/import.go b/bridge/launchpad/import.go index 619631b3..ecbf74f8 100644 --- a/bridge/launchpad/import.go +++ b/bridge/launchpad/import.go @@ -38,7 +38,6 @@ func (li *launchpadImporter) ensurePerson(repo *cache.RepoCache, owner LPPerson) return repo.NewIdentityRaw( owner.Name, "", - owner.Login, "", map[string]string{ metaKeyLaunchpadLogin: owner.Login, -- cgit From f515b9a1291ddd3e4fe1b43bf5891ab19569e33f Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Tue, 4 Feb 2020 00:25:27 +0100 Subject: gitlab also compile --- bridge/launchpad/config.go | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'bridge/launchpad') diff --git a/bridge/launchpad/config.go b/bridge/launchpad/config.go index edbd941d..674aff00 100644 --- a/bridge/launchpad/config.go +++ b/bridge/launchpad/config.go @@ -1,17 +1,15 @@ package launchpad import ( - "bufio" "errors" "fmt" "net/http" - "os" "regexp" - "strings" "time" "github.com/MichaelMure/git-bug/bridge/core" "github.com/MichaelMure/git-bug/cache" + "github.com/MichaelMure/git-bug/input" ) var ErrBadProjectURL = errors.New("bad Launchpad project URL") @@ -45,7 +43,7 @@ func (l *Launchpad) Configure(repo *cache.RepoCache, params core.BridgeParams) ( project, err = splitURL(params.URL) default: // get project name from terminal prompt - project, err = promptProjectName() + project, err = input.Prompt("Launchpad project name", "project name", input.Required) } if err != nil { @@ -86,26 +84,6 @@ func (*Launchpad) ValidateConfig(conf core.Configuration) error { return nil } -func promptProjectName() (string, error) { - for { - fmt.Print("Launchpad project name: ") - - line, err := bufio.NewReader(os.Stdin).ReadString('\n') - if err != nil { - return "", err - } - - line = strings.TrimRight(line, "\n") - - if line == "" { - fmt.Println("Project name is empty") - continue - } - - return line, nil - } -} - func validateProject(project string) (bool, error) { url := fmt.Sprintf("%s/%s", apiRoot, project) -- cgit From 646fd681ffba59d4a74ec3d99558d2ed70b0106b Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Tue, 4 Feb 2020 22:05:34 +0100 Subject: it compiles \o/ --- bridge/launchpad/config.go | 7 ------- bridge/launchpad/import.go | 5 ----- bridge/launchpad/launchpad.go | 19 +++++++++++++++++++ 3 files changed, 19 insertions(+), 12 deletions(-) (limited to 'bridge/launchpad') diff --git a/bridge/launchpad/config.go b/bridge/launchpad/config.go index 674aff00..e029fad3 100644 --- a/bridge/launchpad/config.go +++ b/bridge/launchpad/config.go @@ -5,7 +5,6 @@ import ( "fmt" "net/http" "regexp" - "time" "github.com/MichaelMure/git-bug/bridge/core" "github.com/MichaelMure/git-bug/cache" @@ -14,12 +13,6 @@ import ( var ErrBadProjectURL = errors.New("bad Launchpad project URL") -const ( - target = "launchpad-preview" - keyProject = "project" - defaultTimeout = 60 * time.Second -) - func (l *Launchpad) Configure(repo *cache.RepoCache, params core.BridgeParams) (core.Configuration, error) { if params.TokenRaw != "" { fmt.Println("warning: token params are ineffective for a Launchpad bridge") diff --git a/bridge/launchpad/import.go b/bridge/launchpad/import.go index ecbf74f8..5bca8e63 100644 --- a/bridge/launchpad/import.go +++ b/bridge/launchpad/import.go @@ -20,11 +20,6 @@ func (li *launchpadImporter) Init(repo *cache.RepoCache, conf core.Configuration return nil } -const ( - metaKeyLaunchpadID = "launchpad-id" - metaKeyLaunchpadLogin = "launchpad-login" -) - func (li *launchpadImporter) ensurePerson(repo *cache.RepoCache, owner LPPerson) (*cache.IdentityCache, error) { // Look first in the cache i, err := repo.ResolveIdentityImmutableMetadata(metaKeyLaunchpadLogin, owner.Login) diff --git a/bridge/launchpad/launchpad.go b/bridge/launchpad/launchpad.go index 030d9169..b4fcdd00 100644 --- a/bridge/launchpad/launchpad.go +++ b/bridge/launchpad/launchpad.go @@ -2,15 +2,34 @@ package launchpad import ( + "time" + "github.com/MichaelMure/git-bug/bridge/core" ) +const ( + target = "launchpad-preview" + + metaKeyLaunchpadID = "launchpad-id" + metaKeyLaunchpadLogin = "launchpad-login" + + keyProject = "project" + + defaultTimeout = 60 * time.Second +) + +var _ core.BridgeImpl = &Launchpad{} + type Launchpad struct{} func (*Launchpad) Target() string { return "launchpad-preview" } +func (l *Launchpad) LoginMetaKey() string { + return metaKeyLaunchpadLogin +} + func (*Launchpad) NewImporter() core.Importer { return &launchpadImporter{} } -- cgit