blob: 8469dbd3d8b9e25e1ec2e693927b2cd67a3d0e97 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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
}
|