This repository has been archived by the owner on Nov 22, 2022. It is now read-only.
/
mr.go
73 lines (67 loc) · 2.89 KB
/
mr.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package mr
import (
"github.com/MakeNowJust/heredoc"
"github.com/profclems/glab/commands/cmdutils"
mrApproveCmd "github.com/profclems/glab/commands/mr/approve"
mrApproversCmd "github.com/profclems/glab/commands/mr/approvers"
mrCheckoutCmd "github.com/profclems/glab/commands/mr/checkout"
mrCloseCmd "github.com/profclems/glab/commands/mr/close"
mrCreateCmd "github.com/profclems/glab/commands/mr/create"
mrDeleteCmd "github.com/profclems/glab/commands/mr/delete"
mrDiffCmd "github.com/profclems/glab/commands/mr/diff"
mrForCmd "github.com/profclems/glab/commands/mr/for"
mrIssuesCmd "github.com/profclems/glab/commands/mr/issues"
mrListCmd "github.com/profclems/glab/commands/mr/list"
mrMergeCmd "github.com/profclems/glab/commands/mr/merge"
mrNoteCmd "github.com/profclems/glab/commands/mr/note"
mrRebaseCmd "github.com/profclems/glab/commands/mr/rebase"
mrReopenCmd "github.com/profclems/glab/commands/mr/reopen"
mrRevokeCmd "github.com/profclems/glab/commands/mr/revoke"
mrSubscribeCmd "github.com/profclems/glab/commands/mr/subscribe"
mrTodoCmd "github.com/profclems/glab/commands/mr/todo"
mrUnsubscribeCmd "github.com/profclems/glab/commands/mr/unsubscribe"
mrUpdateCmd "github.com/profclems/glab/commands/mr/update"
mrViewCmd "github.com/profclems/glab/commands/mr/view"
"github.com/spf13/cobra"
)
func NewCmdMR(f *cmdutils.Factory) *cobra.Command {
var mrCmd = &cobra.Command{
Use: "mr <command> [flags]",
Short: `Create, view and manage merge requests`,
Long: ``,
Example: heredoc.Doc(`
$ glab mr create --autofill --labels bugfix
$ glab mr merge 123
$ glab mr note -m "needs to do X before it can be merged" branch-foo
`),
Annotations: map[string]string{
"help:arguments": heredoc.Doc(`
A merge request can be supplied as argument in any of the following formats:
- by number, e.g. "123"; or
- by the name of its source branch, e.g. "patch-1" or "OWNER:patch-1".
`),
},
}
cmdutils.EnableRepoOverride(mrCmd, f)
mrCmd.AddCommand(mrApproveCmd.NewCmdApprove(f))
mrCmd.AddCommand(mrApproversCmd.NewCmdApprovers(f))
mrCmd.AddCommand(mrCheckoutCmd.NewCmdCheckout(f))
mrCmd.AddCommand(mrCloseCmd.NewCmdClose(f))
mrCmd.AddCommand(mrCreateCmd.NewCmdCreate(f, nil))
mrCmd.AddCommand(mrDeleteCmd.NewCmdDelete(f))
mrCmd.AddCommand(mrDiffCmd.NewCmdDiff(f, nil))
mrCmd.AddCommand(mrForCmd.NewCmdFor(f))
mrCmd.AddCommand(mrIssuesCmd.NewCmdIssues(f))
mrCmd.AddCommand(mrListCmd.NewCmdList(f, nil))
mrCmd.AddCommand(mrMergeCmd.NewCmdMerge(f))
mrCmd.AddCommand(mrNoteCmd.NewCmdNote(f))
mrCmd.AddCommand(mrRebaseCmd.NewCmdRebase(f))
mrCmd.AddCommand(mrReopenCmd.NewCmdReopen(f))
mrCmd.AddCommand(mrRevokeCmd.NewCmdRevoke(f))
mrCmd.AddCommand(mrSubscribeCmd.NewCmdSubscribe(f))
mrCmd.AddCommand(mrUnsubscribeCmd.NewCmdUnsubscribe(f))
mrCmd.AddCommand(mrTodoCmd.NewCmdTodo(f))
mrCmd.AddCommand(mrUpdateCmd.NewCmdUpdate(f))
mrCmd.AddCommand(mrViewCmd.NewCmdView(f))
return mrCmd
}