From bcd904d2d5f6422888d26e82c9f334acd268f846 Mon Sep 17 00:00:00 2001 From: rsteube Date: Sun, 29 Oct 2023 19:13:25 +0100 Subject: [PATCH] git: fmt-merge-msg --- completers/git_completer/cmd/fmtMergeMsg.go | 30 +++++++++++++++++++ .../cmd/fmt_merge_msg_generated.go | 21 ------------- 2 files changed, 30 insertions(+), 21 deletions(-) create mode 100644 completers/git_completer/cmd/fmtMergeMsg.go delete mode 100644 completers/git_completer/cmd/fmt_merge_msg_generated.go diff --git a/completers/git_completer/cmd/fmtMergeMsg.go b/completers/git_completer/cmd/fmtMergeMsg.go new file mode 100644 index 0000000000..5dcd9ad884 --- /dev/null +++ b/completers/git_completer/cmd/fmtMergeMsg.go @@ -0,0 +1,30 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/git" + "github.com/spf13/cobra" +) + +var fmtMergeMsgCmd = &cobra.Command{ + Use: "fmt-merge-msg", + Short: "Produce a merge commit message", + Run: func(cmd *cobra.Command, args []string) {}, + GroupID: groups[group_low_level_helper].ID, +} + +func init() { + carapace.Gen(fmtMergeMsgCmd).Standalone() + + fmtMergeMsgCmd.Flags().StringP("file", "F", "", "Take the list of merged objects from instead of stdin") + fmtMergeMsgCmd.Flags().String("into-name", "", "Prepare the merge message as if merging to the branch ") + fmtMergeMsgCmd.Flags().String("log", "", "At most commits from each merge parent will be used (20 if is omitted)") + fmtMergeMsgCmd.Flags().StringP("message", "m", "", "Use instead of the branch names for the first line of the log message") + fmtMergeMsgCmd.Flags().Bool("no-log", false, "Do not list one-line descriptions from the actual commits being merged") + rootCmd.AddCommand(fmtMergeMsgCmd) + + carapace.Gen(fmtMergeMsgCmd).FlagCompletion(carapace.ActionMap{ + "file": carapace.ActionFiles(), + "into-name": git.ActionRefs(git.RefOption{LocalBranches: true, RemoteBranches: true, Tags: true}), + }) +} diff --git a/completers/git_completer/cmd/fmt_merge_msg_generated.go b/completers/git_completer/cmd/fmt_merge_msg_generated.go deleted file mode 100644 index 2064a30e44..0000000000 --- a/completers/git_completer/cmd/fmt_merge_msg_generated.go +++ /dev/null @@ -1,21 +0,0 @@ -package cmd - -import ( - "github.com/rsteube/carapace" - "github.com/spf13/cobra" -) - -var fmt_merge_msgCmd = &cobra.Command{ - Use: "fmt-merge-msg", - Short: "Produce a merge commit message", - Run: func(cmd *cobra.Command, args []string) {}, - GroupID: groups[group_low_level_helper].ID, -} - -func init() { - carapace.Gen(fmt_merge_msgCmd).Standalone() - fmt_merge_msgCmd.Flags().BoolP("file", "F", false, " file to read from") - fmt_merge_msgCmd.Flags().String("log", "", "populate log with at most entries from shortlog") - fmt_merge_msgCmd.Flags().BoolP("message", "m", false, " use as start of message") - rootCmd.AddCommand(fmt_merge_msgCmd) -}