github.com/zaquestion/lab@v0.25.1/cmd/mr_rebase.go (about) 1 package cmd 2 3 import ( 4 "github.com/rsteube/carapace" 5 "github.com/spf13/cobra" 6 "github.com/zaquestion/lab/internal/action" 7 lab "github.com/zaquestion/lab/internal/gitlab" 8 ) 9 10 var mrRebaseCmd = &cobra.Command{ 11 Use: "rebase [remote] [<MR id or branch>]", 12 Short: "Rebase an open merge request", 13 Example: "lab mr rebase upstream 20", 14 PersistentPreRun: labPersistentPreRun, 15 Run: func(cmd *cobra.Command, args []string) { 16 rn, id, err := parseArgsWithGitBranchMR(args) 17 if err != nil { 18 log.Fatal(err) 19 } 20 21 err = lab.MRRebase(rn, int(id)) 22 if err != nil { 23 log.Fatal(err) 24 } 25 }, 26 } 27 28 func init() { 29 mrCmd.AddCommand(mrRebaseCmd) 30 carapace.Gen(mrRebaseCmd).PositionalCompletion( 31 action.Remotes(), 32 action.MergeRequests(mrList), 33 ) 34 }