-
Notifications
You must be signed in to change notification settings - Fork 0
/
epic.go
45 lines (38 loc) · 813 Bytes
/
epic.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
42
43
44
45
package issue
import (
"github.com/locona/jira/pkg/issue"
"github.com/locona/jira/pkg/prompt"
"github.com/andygrunwald/go-jira"
"github.com/briandowns/spinner"
"github.com/spf13/cobra"
)
func NewCommandEpic() *cobra.Command {
cmd := &cobra.Command{
Use: "epic",
RunE: func(cmd *cobra.Command, args []string) error {
return Epic()
},
}
return cmd
}
type EpicCommand struct {
Result []jira.Issue
}
func (cmd *EpicCommand) BeforeRequest(s *spinner.Spinner) *spinner.Spinner {
return s
}
func (cmd *EpicCommand) Request(s *spinner.Spinner) error {
epics, err := issue.Epic()
if err != nil {
return err
}
cmd.Result = epics
return nil
}
func (cmd *EpicCommand) Response() error {
issue.ViewTable(cmd.Result)
return nil
}
func Epic() error {
return prompt.Progress(&EpicCommand{})
}