mirror of
https://github.com/rsteube/carapace-bin.git
synced 2025-05-15 04:04:31 +00:00
git: added switch
This commit is contained in:
parent
580978eaaa
commit
f309a97b8b
@ -1,23 +1,26 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/rsteube/carapace"
|
||||
"github.com/rsteube/carapace-bin/pkg/actions/git"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var switchCmd = &cobra.Command{
|
||||
Use: "switch",
|
||||
Short: "Switch branches",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
},
|
||||
Run: func(cmd *cobra.Command, args []string) {},
|
||||
}
|
||||
|
||||
func init() {
|
||||
carapace.Gen(switchCmd).Standalone()
|
||||
|
||||
switchCmd.Flags().String("conflict", "", "conflict style (merge or diff3)")
|
||||
switchCmd.Flags().BoolP("create", "c", false, "<branch> create and switch to a new branch")
|
||||
switchCmd.Flags().StringP("create", "c", "", "create and switch to a new branch")
|
||||
switchCmd.Flags().BoolP("detach", "d", false, "detach HEAD at named commit")
|
||||
switchCmd.Flags().Bool("discard-changes", false, "throw away local modifications")
|
||||
switchCmd.Flags().BoolP("force", "f", false, "force checkout (throw away local modifications)")
|
||||
switchCmd.Flags().BoolP("force-create", "C", false, "<branch> create/reset and switch to a branch")
|
||||
switchCmd.Flags().StringP("force-create", "C", "", "create/reset and switch to a branch")
|
||||
switchCmd.Flags().Bool("guess", false, "second guess 'git switch <no-such-branch>'")
|
||||
switchCmd.Flags().Bool("ignore-other-worktrees", false, "do not check if another worktree is holding the given ref")
|
||||
switchCmd.Flags().BoolP("merge", "m", false, "perform a 3-way merge with the new branch")
|
||||
@ -28,4 +31,17 @@ func init() {
|
||||
switchCmd.Flags().String("recurse-submodules", "", "control recursive updating of submodules")
|
||||
switchCmd.Flags().BoolP("track", "t", false, "set upstream info for new branch")
|
||||
rootCmd.AddCommand(switchCmd)
|
||||
|
||||
switchCmd.Flag("recurse-submodules").NoOptDefVal = " "
|
||||
|
||||
carapace.Gen(switchCmd).FlagCompletion(carapace.ActionMap{
|
||||
"create": git.ActionRefs(git.RefOption{LocalBranches: true}),
|
||||
"force-create": git.ActionRefs(git.RefOption{LocalBranches: true}),
|
||||
"conflict": carapace.ActionValues("merge", "diff3"),
|
||||
"orphan": git.ActionRefs(git.RefOption{LocalBranches: true}),
|
||||
})
|
||||
|
||||
carapace.Gen(switchCmd).PositionalCompletion(
|
||||
git.ActionRefs(git.RefOption{LocalBranches: true}),
|
||||
)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user