diff --git a/cmd/issue_note.go b/cmd/issue_note.go index 6a0393c4..e717fbd3 100644 --- a/cmd/issue_note.go +++ b/cmd/issue_note.go @@ -311,38 +311,6 @@ func replyNote(rn string, isMR bool, idNum int, reply int, quote bool, update bo } } -func filterCommentArg(args []string) (int, []string, error) { - branchArgs := []string{} - idString := "" - - if len(args) == 1 { - ok, err := git.IsRemote(args[0]) - if err != nil { - return 0, branchArgs, err - } - if ok { - branchArgs = append(branchArgs, args[0]) - } else { - idString = args[0] - } - } else if len(args) > 1 { - branchArgs = append(branchArgs, args[0]) - idString = args[1] - } - - if strings.Contains(idString, ":") { - ps := strings.Split(idString, ":") - branchArgs = append(branchArgs, ps[0]) - idString = ps[1] - } else { - branchArgs = append(branchArgs, idString) - idString = "" - } - - idNum, _ := strconv.Atoi(idString) - return idNum, branchArgs, nil -} - func init() { issueNoteCmd.Flags().StringArrayP("message", "m", []string{}, "use the given ; multiple -m are concatenated as separate paragraphs") issueNoteCmd.Flags().StringP("file", "F", "", "use the given file as the message") diff --git a/cmd/util.go b/cmd/util.go index 0ef67684..35d07cc8 100644 --- a/cmd/util.go +++ b/cmd/util.go @@ -299,6 +299,38 @@ func parseArgsWithGitBranchMR(args []string) (string, int64, error) { return s, i, nil } +func filterCommentArg(args []string) (int, []string, error) { + branchArgs := []string{} + idString := "" + + if len(args) == 1 { + ok, err := git.IsRemote(args[0]) + if err != nil { + return 0, branchArgs, err + } + if ok { + branchArgs = append(branchArgs, args[0]) + } else { + idString = args[0] + } + } else if len(args) > 1 { + branchArgs = append(branchArgs, args[0]) + idString = args[1] + } + + if strings.Contains(idString, ":") { + ps := strings.Split(idString, ":") + branchArgs = append(branchArgs, ps[0]) + idString = ps[1] + } else { + branchArgs = append(branchArgs, idString) + idString = "" + } + + idNum, _ := strconv.Atoi(idString) + return idNum, branchArgs, nil +} + // setCommandPrefix returns a concatenated value of some of the commandline. // For example, 'lab mr show' would return 'mr_show.', and 'lab issue list' // would return 'issue_list.'