From 9c301ff91378852dfd00bb3281344d9387170361 Mon Sep 17 00:00:00 2001 From: rsteube Date: Sat, 25 Mar 2023 11:06:16 +0100 Subject: [PATCH] git: filter-branch --- completers/git_completer/cmd/filterBranch.go | 45 +++++++++++++++++++ .../cmd/filter_branch_generated.go | 17 ------- 2 files changed, 45 insertions(+), 17 deletions(-) create mode 100644 completers/git_completer/cmd/filterBranch.go delete mode 100644 completers/git_completer/cmd/filter_branch_generated.go diff --git a/completers/git_completer/cmd/filterBranch.go b/completers/git_completer/cmd/filterBranch.go new file mode 100644 index 0000000000..654d240583 --- /dev/null +++ b/completers/git_completer/cmd/filterBranch.go @@ -0,0 +1,45 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/bridge" + "github.com/rsteube/carapace-bin/pkg/actions/tools/git" + "github.com/spf13/cobra" +) + +var filterBranchCmd = &cobra.Command{ + Use: "filter-branch", + Short: "Rewrite branches", + Run: func(cmd *cobra.Command, args []string) {}, + GroupID: groups[group_manipulator].ID, +} + +func init() { + carapace.Gen(filterBranchCmd).Standalone() + + filterBranchCmd.Flags().String("commit-filter", "", "This is the filter for performing the commit") + filterBranchCmd.Flags().StringS("d", "d", "", "Use this option to set the path to the temporary directory used for rewriting") + filterBranchCmd.Flags().String("env-filter", "", "This filter may be used if you only need to modify the environment in which the commit will be performed") + filterBranchCmd.Flags().BoolP("force", "f", false, "Force to start with an existing temporary directory or when there are already refs starting with refs/original/") + filterBranchCmd.Flags().String("index-filter", "", "This is the filter for rewriting the index") + filterBranchCmd.Flags().String("msg-filter", "", "This is the filter for rewriting the commit messages") + filterBranchCmd.Flags().String("original", "", "Use this option to set the namespace where the original commits will be stored") + filterBranchCmd.Flags().String("parent-filter", "", "This is the filter for rewriting the commit’s parent list") + filterBranchCmd.Flags().Bool("prune-empty", false, "Some filters will generate empty commits that leave the tree untouched") + filterBranchCmd.Flags().String("setup", "", "This is not a real filter executed for each commit but a one time setup just before the loop") + filterBranchCmd.Flags().String("state-branch", "", "This option will cause the mapping from old to new objects to be loaded from named branch") + filterBranchCmd.Flags().String("subdirectory-filter", "", "Only look at the history which touches the given subdirectory") + filterBranchCmd.Flags().String("tag-name-filter", "", "This is the filter for rewriting tag names") + filterBranchCmd.Flags().String("tree-filter", "", "This is the filter for rewriting the tree and its contents") + rootCmd.AddCommand(filterBranchCmd) + + carapace.Gen(filterBranchCmd).FlagCompletion(carapace.ActionMap{ + "d": carapace.ActionDirectories(), + "state-branch": git.ActionLocalBranches(), + "subdirectory-filter": carapace.ActionDirectories(), + }) + + carapace.Gen(filterBranchCmd).DashAnyCompletion( + bridge.ActionCarapaceBin("git", "rev-list"), + ) +} diff --git a/completers/git_completer/cmd/filter_branch_generated.go b/completers/git_completer/cmd/filter_branch_generated.go deleted file mode 100644 index 01cefd49bd..0000000000 --- a/completers/git_completer/cmd/filter_branch_generated.go +++ /dev/null @@ -1,17 +0,0 @@ -package cmd - -import ( - "github.com/spf13/cobra" -) - -var filter_branchCmd = &cobra.Command{ - Use: "filter-branch", - Short: "Rewrite branches", - Run: func(cmd *cobra.Command, args []string) {}, - GroupID: groups[group_manipulator].ID, -} - -func init() { - - rootCmd.AddCommand(filter_branchCmd) -}