@@ -9,47 +9,43 @@ import (
9
9
"github.com/inverse/git-pair/internal/util"
10
10
)
11
11
12
- func Start () {
12
+ func Start () error {
13
13
localContributors , err := contributors .GetLocalContributors ()
14
14
if err != nil {
15
- fmt .Printf ("Failed to load local contributors: %s\n " , err )
16
- return
15
+ return fmt .Errorf ("Failed to load local contributors: %w" , err )
17
16
}
18
17
19
18
repoContributors , err := git .GetRepoContributors ()
20
19
if err != nil {
21
- fmt .Printf ("Failed to load repo contributors: %s\n " , err )
22
- return
20
+ return fmt .Errorf ("Failed to load repo contributors: %w" , err )
23
21
}
24
22
25
23
allContributors := util .UniqueStrings (append (localContributors , repoContributors ... ))
26
24
if len (allContributors ) == 0 {
27
- fmt .Println ("No contributors found" )
28
- return
25
+ fmt .Println ("⚠️ No contributors found" )
26
+ return nil
29
27
}
30
28
31
- selectedContributors := []string {}
29
+ var selectedContributors []string
30
+
32
31
prompt := & survey.MultiSelect {
33
32
Message : "Who's pairing:" ,
34
33
Options : allContributors ,
35
34
}
36
35
37
- err = survey .AskOne (prompt , & selectedContributors )
38
- if err != nil {
39
- fmt .Println (err )
40
- return
36
+ if err := survey .AskOne (prompt , & selectedContributors ); err != nil {
37
+ return err
41
38
}
42
39
43
40
if len (selectedContributors ) == 0 {
44
41
fmt .Println ("You must select at least one contributor" )
45
- return
42
+ return nil
46
43
}
47
44
48
- err = git .EnablePairingMode (selectedContributors )
49
- if err != nil {
50
- fmt .Println (err )
51
- return
45
+ if err := git .EnablePairingMode (selectedContributors ); err != nil {
46
+ return err
52
47
}
53
48
54
49
fmt .Println ("🚀 Pairing mode started" )
50
+ return nil
55
51
}
0 commit comments