-
Notifications
You must be signed in to change notification settings - Fork 0
/
glab_cmd.go
49 lines (43 loc) · 1.1 KB
/
glab_cmd.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
package glabcmd
import (
"github.com/gookit/gcli/v3"
"github.com/gookit/gcli/v3/events"
"github.com/inhere/kite-go/internal/app"
"github.com/inhere/kite-go/internal/cli/gitcmd"
"github.com/inhere/kite-go/pkg/gitx"
)
var glOpts = struct {
gitcmd.AutoChDir
}{}
// GitLabCmd commands
var GitLabCmd = &gcli.Command{
Name: "gitlab",
Desc: "useful tool commands for use gitlab",
Aliases: []string{"gl", "glab"},
Subs: []*gcli.Command{
ResolveConflictCmd,
MergeRequestCmd,
gitcmd.BatchCmd,
gitcmd.NewInitFlowCmd(),
gitcmd.NewBranchCmd(),
gitcmd.NewCheckoutCmd(),
gitcmd.NewCloneCmd(configProvider),
gitcmd.NewUpdateCmd(),
gitcmd.NewUpdatePushCmd(),
gitcmd.NewAddCommitPush(),
gitcmd.NewAddCommitCmd(),
gitcmd.NewOpenRemoteCmd(configProvider),
},
Config: func(c *gcli.Command) {
glOpts.BindChdirFlags(c)
c.On(events.OnCmdRunBefore, func(ctx *gcli.HookCtx) (stop bool) {
wd := c.WorkDir()
c.Infoln("[kite.GLAB] Workdir:", wd)
return false
})
c.On(events.OnCmdSubNotFound, gitcmd.RedirectToGitx)
},
}
func configProvider() *gitx.Config {
return app.Glab().Config
}