github.com/zaquestion/lab@v0.25.1/cmd/issue_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 issueNoteCmd = &cobra.Command{
    11  	Use:     "note [remote] <id>[:<comment_id>]",
    12  	Aliases: []string{"comment", "reply"},
    13  	Short:   "Add a note or comment to an issue on GitLab",
    14  	Args:    cobra.MinimumNArgs(1),
    15  	Example: heredoc.Doc(`
    16  		lab issue note 1
    17  		lab issue note 2 -F test_file --force-linebreak
    18  		lab issue note origin 2 -m "a message" -m "another one"
    19  		lab issue note upstream 1:613278106 --quote`),
    20  	PersistentPreRun: labPersistentPreRun,
    21  	Run:              noteRunFn,
    22  }
    23  
    24  func init() {
    25  	issueNoteCmd.Flags().StringArrayP("message", "m", []string{}, "use the given <msg>; multiple -m are concatenated as separate paragraphs")
    26  	issueNoteCmd.Flags().StringP("file", "F", "", "use the given file as the message")
    27  	issueNoteCmd.Flags().Bool("force-linebreak", false, "append 2 spaces to the end of each line to force markdown linebreaks")
    28  	issueNoteCmd.Flags().Bool("quote", false, "quote note in reply")
    29  	issueNoteCmd.Flags().Bool("resolve", false, "[unused in issue note command]")
    30  	issueNoteCmd.Flags().MarkHidden("resolve")
    31  	issueNoteCmd.Flags().StringP("commit", "", "", "[unused in issue note command]")
    32  	issueNoteCmd.Flags().MarkHidden("commit")
    33  
    34  	issueCmd.AddCommand(issueNoteCmd)
    35  	carapace.Gen(issueNoteCmd).PositionalCompletion(
    36  		action.Remotes(),
    37  		action.Issues(issueList),
    38  	)
    39  }