diff options
author | Michael Muré <batolettre@gmail.com> | 2020-02-04 00:25:27 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-02-08 17:19:57 +0100 |
commit | f515b9a1291ddd3e4fe1b43bf5891ab19569e33f (patch) | |
tree | 05f043ba5d2279f547d6dbc8e2f938c240f9b04d /bridge/launchpad/config.go | |
parent | 74e91144105790cc997c1d79a7f638e1e3a1f3f8 (diff) | |
download | git-bug-f515b9a1291ddd3e4fe1b43bf5891ab19569e33f.tar.gz |
gitlab also compile
Diffstat (limited to 'bridge/launchpad/config.go')
-rw-r--r-- | bridge/launchpad/config.go | 26 |
1 files changed, 2 insertions, 24 deletions
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) |