github.com/zaquestion/lab@v0.25.1/cmd/mr_note.go (about)

     1  package cmd
     2  
     3  import (
     4  	"github.com/MakeNowJust/heredoc/v2"
     5  	"github.com/rsteube/carapace"
     6  	"github.com/spf13/cobra"
     7  	"github.com/zaquestion/lab/internal/action"
     8  )
     9  
    10  var mrNoteCmd = &cobra.Command{
    11  	Use:     "note [remote] <id>[:<comment_id>]",
    12  	Aliases: []string{"comment", "reply", "resolve"},
    13  	Short:   "Add a note or comment to an MR on GitLab",
    14  	Example: heredoc.Doc(`
    15  		lab mr note origin
    16  		lab mr note upstream -F test_file
    17  		lab mr note a_remote -F test_file --force-linebreak
    18  		lab mr note upstream -m "A helpfull comment"
    19  		lab mr note upstream:613278106 --quote
    20  		lab mr note upstream:613278107 --resolve
    21  		lab mr note upstream:613278108 --commit abcdef123456`),
    22  	PersistentPreRun: labPersistentPreRun,
    23  	Run:              noteRunFn,
    24  }
    25  
    26  func init() {
    27  	mrNoteCmd.Flags().StringArrayP("message", "m", []string{}, "use the given <msg>; multiple -m are concatenated as separate paragraphs")
    28  	mrNoteCmd.Flags().StringP("file", "F", "", "use the given file as the message")
    29  	mrNoteCmd.Flags().Bool("force-linebreak", false, "append 2 spaces to the end of each line to force markdown linebreaks")
    30  	mrNoteCmd.Flags().Bool("quote", false, "quote note in reply")
    31  	mrNoteCmd.Flags().Bool("resolve", false, "mark thread resolved")
    32  	mrNoteCmd.Flags().StringP("commit", "c", "", "start a thread on a commit")
    33  
    34  	mrCmd.AddCommand(mrNoteCmd)
    35  	carapace.Gen(mrNoteCmd).PositionalCompletion(
    36  		action.Remotes(),
    37  		action.MergeRequests(mrList),
    38  	)
    39  }