aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/launchpad/config.go
diff options
context:
space:
mode:
authorCyril Roelandt <tipecaml@gmail.com>2018-12-08 03:58:51 +0100
committerCyril Roelandt <tipecaml@gmail.com>2018-12-16 00:51:22 +0100
commitd6ddf0ef5c64cdb5262bcaba8018e6345ea391a1 (patch)
tree059dc88d40ebf99a83ffea8f669f33df8cfbfbdc /bridge/launchpad/config.go
parent63807382d345d93a939c8ffb8bed04fa2a840f66 (diff)
downloadgit-bug-d6ddf0ef5c64cdb5262bcaba8018e6345ea391a1.tar.gz
Initial Launchpad bridge.
This a just a preview. Not all features are expected to work.
Diffstat (limited to 'bridge/launchpad/config.go')
-rw-r--r--bridge/launchpad/config.go50
1 files changed, 50 insertions, 0 deletions
diff --git a/bridge/launchpad/config.go b/bridge/launchpad/config.go
new file mode 100644
index 00000000..8469dbd3
--- /dev/null
+++ b/bridge/launchpad/config.go
@@ -0,0 +1,50 @@
+package launchpad
+
+import (
+ "bufio"
+ "fmt"
+ "os"
+ "strings"
+
+ "github.com/MichaelMure/git-bug/bridge/core"
+ "github.com/MichaelMure/git-bug/repository"
+)
+
+const keyProject = "project"
+
+func (*Launchpad) Configure(repo repository.RepoCommon) (core.Configuration, error) {
+ conf := make(core.Configuration)
+
+ projectName, err := promptProjectName()
+ if err != nil {
+ return nil, err
+ }
+
+ conf[keyProject] = projectName
+
+ return conf, 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 (*Launchpad) ValidateConfig(conf core.Configuration) error {
+ return nil
+}