-
Notifications
You must be signed in to change notification settings - Fork 1
/
cmd_run.go
41 lines (37 loc) · 915 Bytes
/
cmd_run.go
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
package main
import (
"fmt"
"github.com/wsxiaoys/terminal/color"
"os"
)
var CmdRun = &Cmd{
Name: "run",
Desc: "run erk to search inline issue.",
Fn: func(args []string) error {
err := ParseFiles( /*basePath*/)
if err != nil {
return err
}
basePath, err := os.Getwd()
if err != nil {
return err
}
color.Printf(INIT_MESSAGE, basePath)
for _, issue := range IssueList {
color.Printf(`[@{!b}%s@{|}] at @{!c}%s@{|}
line %d - @{!w}%s
`, issue.Label, issue.FilePath, issue.Line, issue.Title)
}
if runWithRemote {
color.Printf("updating remote issues...\n")
if HasRemoteConfiguration() {
// [todo] - supports other adapters(for bitbucket?)
var adapter Adapter = &AdapterGithub{}
adapter.Update()
} else {
return fmt.Errorf("Configuration file: can't load remote_config option successfully. please check your %s.", CONF_FILENAME)
}
}
return nil
},
}