aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/launchpad/config.go
diff options
context:
space:
mode:
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
+}