-
-
Notifications
You must be signed in to change notification settings - Fork 48
/
action.go
59 lines (55 loc) · 1.51 KB
/
action.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package action
import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/tea"
"github.com/spf13/cobra"
)
func ActionIssues(cmd *cobra.Command, open bool) carapace.Action {
return carapace.ActionCallback(func(c carapace.Context) carapace.Action {
opts := tea.IssueOpts{}
if f := cmd.Flag("login"); f != nil {
opts.Login = f.Value.String()
}
if f := cmd.Flag("remote"); f != nil {
opts.Remote = f.Value.String()
}
if f := cmd.Flag("repo"); f != nil {
opts.Repo = f.Value.String()
}
opts.Open = open
opts.Closed = !open
return tea.ActionIssues(opts)
})
}
func ActionPullrequests(cmd *cobra.Command, open bool) carapace.Action {
return carapace.ActionCallback(func(c carapace.Context) carapace.Action {
opts := tea.PullrequestOpts{}
if f := cmd.Flag("login"); f != nil {
opts.Login = f.Value.String()
}
if f := cmd.Flag("remote"); f != nil {
opts.Remote = f.Value.String()
}
if f := cmd.Flag("repo"); f != nil {
opts.Repo = f.Value.String()
}
opts.Open = open
opts.Closed = !open
return tea.ActionPullrequests(opts)
})
}
func ActionLabels(cmd *cobra.Command) carapace.Action {
return carapace.ActionCallback(func(c carapace.Context) carapace.Action {
opts := tea.RepoOpts{}
if f := cmd.Flag("login"); f != nil {
opts.Login = f.Value.String()
}
if f := cmd.Flag("remote"); f != nil {
opts.Remote = f.Value.String()
}
if f := cmd.Flag("repo"); f != nil {
opts.Repo = f.Value.String()
}
return tea.ActionLabels(opts)
})
}