From 027020ed1027348ff3e8b775081e591fcac591a3 Mon Sep 17 00:00:00 2001 From: rsteube Date: Sat, 17 Aug 2024 23:12:46 +0200 Subject: [PATCH] git: replay --- completers/git_completer/cmd/replay.go | 37 ++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 completers/git_completer/cmd/replay.go diff --git a/completers/git_completer/cmd/replay.go b/completers/git_completer/cmd/replay.go new file mode 100644 index 0000000000..10e8698984 --- /dev/null +++ b/completers/git_completer/cmd/replay.go @@ -0,0 +1,37 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/carapace-sh/carapace-bin/completers_release/git_completer/cmd/common" + "github.com/carapace-sh/carapace-bin/pkg/actions/tools/git" + "github.com/spf13/cobra" +) + +var replayCmd = &cobra.Command{ + Use: "replay", + Short: "EXPERIMENTAL: Replay commits on a new base, works with bare repos too", + Run: func(cmd *cobra.Command, args []string) {}, + GroupID: groups[group_low_level_manipulator].ID, +} + +func init() { + carapace.Gen(replayCmd).Standalone() + + replayCmd.Flags().String("advance", "", "starting point at which to create the new commits") + replayCmd.Flags().String("onto", "", "starting point at which to create the new commits") + common.AddCommitFormattingOptions(replayCmd) + common.AddCommitLimitingOptions(replayCmd) + common.AddCommitOrderingOptions(replayCmd) + common.AddHistorySimplificationOptions(replayCmd) + common.AddObjectTraversalOptions(replayCmd) + rootCmd.AddCommand(replayCmd) + + carapace.Gen(replayCmd).FlagCompletion(carapace.ActionMap{ + "advance": git.ActionRefs(git.RefOption{}.Default()), + "onto": git.ActionLocalBranches(), + }) + + carapace.Gen(replayCmd).PositionalAnyCompletion( + git.ActionRefRanges(git.RefOption{}.Default()), + ) +}