From cb3e5b4e5aa0e32cf032d694dc2142b076a3f0ac Mon Sep 17 00:00:00 2001 From: rsteube Date: Fri, 16 Aug 2024 16:51:50 +0200 Subject: [PATCH] git: merge-file --- completers/git_completer/cmd/mergeFile.go | 40 +++++++++++++++++++ .../git_completer/cmd/merge_file_generated.go | 26 ------------ 2 files changed, 40 insertions(+), 26 deletions(-) create mode 100644 completers/git_completer/cmd/mergeFile.go delete mode 100644 completers/git_completer/cmd/merge_file_generated.go diff --git a/completers/git_completer/cmd/mergeFile.go b/completers/git_completer/cmd/mergeFile.go new file mode 100644 index 0000000000..c69989413a --- /dev/null +++ b/completers/git_completer/cmd/mergeFile.go @@ -0,0 +1,40 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/carapace-sh/carapace-bin/pkg/actions/tools/git" + "github.com/spf13/cobra" +) + +var mergeFileCmd = &cobra.Command{ + Use: "merge-file", + Short: "Run a three-way file merge", + Run: func(cmd *cobra.Command, args []string) {}, + GroupID: groups[group_low_level_manipulator].ID, +} + +func init() { + carapace.Gen(mergeFileCmd).Standalone() + + mergeFileCmd.Flags().StringSliceS("L", "L", nil, "use labels in place of the file names in conflict reports") + mergeFileCmd.Flags().String("diff-algorithm", "", "use a different diff algorithm while merging") + mergeFileCmd.Flags().Bool("diff3", false, "show conflicts in \"diff3\" style") + mergeFileCmd.Flags().Bool("object-id", false, "specify the contents to merge as blobs in the current repository instead of files") + mergeFileCmd.Flags().Bool("ours", false, "resolve conflicts favouring our side of the lines") + mergeFileCmd.Flags().BoolS("p", "p", false, "send results to standard output instead of overwriting ") + mergeFileCmd.Flags().BoolS("q", "q", false, "do not warn about conflicts") + mergeFileCmd.Flags().Bool("theirs", false, "resolve conflicts favouring their side of the lines") + mergeFileCmd.Flags().Bool("union", false, "resolve conflicts favouring both side of the lines") + mergeFileCmd.Flags().Bool("zdiff3", false, "show conflicts in \"zdiff3\" style") + rootCmd.AddCommand(mergeFileCmd) + + carapace.Gen(mergeFileCmd).FlagCompletion(carapace.ActionMap{ + "diff-algorithm": git.ActionDiffAlgorithms(), + }) + + carapace.Gen(mergeFileCmd).PositionalCompletion( + carapace.ActionFiles(), + carapace.ActionFiles(), + carapace.ActionFiles(), + ) +} diff --git a/completers/git_completer/cmd/merge_file_generated.go b/completers/git_completer/cmd/merge_file_generated.go deleted file mode 100644 index ddd0b619c3..0000000000 --- a/completers/git_completer/cmd/merge_file_generated.go +++ /dev/null @@ -1,26 +0,0 @@ -package cmd - -import ( - "github.com/carapace-sh/carapace" - "github.com/spf13/cobra" -) - -var merge_fileCmd = &cobra.Command{ - Use: "merge-file", - Short: "Run a three-way file merge", - Run: func(cmd *cobra.Command, args []string) {}, - GroupID: groups[group_low_level_manipulator].ID, -} - -func init() { - carapace.Gen(merge_fileCmd).Standalone() - merge_fileCmd.Flags().StringS("L", "L", "", "set labels for file1/orig-file/file2") - merge_fileCmd.Flags().Bool("diff3", false, "use a diff3 based merge") - merge_fileCmd.Flags().String("marker-size", "", "for conflicts, use this marker size") - merge_fileCmd.Flags().Bool("ours", false, "for conflicts, use our version") - merge_fileCmd.Flags().BoolP("quiet", "q", false, "do not warn about conflicts") - merge_fileCmd.Flags().BoolP("stdout", "p", false, "send results to standard output") - merge_fileCmd.Flags().Bool("theirs", false, "for conflicts, use their version") - merge_fileCmd.Flags().Bool("union", false, "for conflicts, use a union version") - rootCmd.AddCommand(merge_fileCmd) -}