Skip to content

Commit

Permalink
git: filter-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Mar 25, 2023
1 parent 072f9fe commit 42c8a5c
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 17 deletions.
45 changes: 45 additions & 0 deletions completers/git_completer/cmd/filterBranch.go
Original file line number Diff line number Diff line change
@@ -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().StringS("d", "d", "", "Use this option to set the path to the temporary directory used for rewriting")
filterBranchCmd.Flags().String("commit-filter", "", "This is the filter for performing the commit")
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"),
)
}
17 changes: 0 additions & 17 deletions completers/git_completer/cmd/filter_branch_generated.go

This file was deleted.

0 comments on commit 42c8a5c

Please sign in to comment.