diff --git a/completers/git_completer/cmd/restore_generated.go b/completers/git_completer/cmd/restore.go similarity index 63% rename from completers/git_completer/cmd/restore_generated.go rename to completers/git_completer/cmd/restore.go index 4982e02214..fb878d423e 100644 --- a/completers/git_completer/cmd/restore_generated.go +++ b/completers/git_completer/cmd/restore.go @@ -1,32 +1,44 @@ package cmd import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/completers/git_completer/cmd/action" "github.com/spf13/cobra" ) var restoreCmd = &cobra.Command{ Use: "restore", Short: "Restore working tree files", - Run: func(cmd *cobra.Command, args []string) { - }, + Run: func(cmd *cobra.Command, args []string) {}, } func init() { - restoreCmd.Flags().BoolP("ours", "2", false, "checkout our version for unmerged files") - restoreCmd.Flags().BoolP("theirs", "3", false, "checkout their version for unmerged files") + carapace.Gen(restoreCmd).Standalone() + restoreCmd.Flags().String("conflict", "", "conflict style (merge or diff3)") restoreCmd.Flags().Bool("ignore-skip-worktree-bits", false, "do not limit pathspecs to sparse entries only") restoreCmd.Flags().Bool("ignore-unmerged", false, "ignore unmerged entries") restoreCmd.Flags().BoolP("merge", "m", false, "perform a 3-way merge with the new branch") + restoreCmd.Flags().BoolP("ours", "2", false, "checkout our version for unmerged files") restoreCmd.Flags().Bool("overlay", false, "use overlay mode") - restoreCmd.Flags().Bool("pathspec-file-nul", false, "with --pathspec-from-file, pathspec elements are separated with NUL character") - restoreCmd.Flags().String("pathspec-from-file", "", "read pathspec from file") restoreCmd.Flags().BoolP("patch", "p", false, "select hunks interactively") + restoreCmd.Flags().Bool("pathspec-file-nul", false, "pathspec elements are separated with NUL character") + restoreCmd.Flags().String("pathspec-from-file", "", "read pathspec from file") restoreCmd.Flags().Bool("progress", false, "force progress reporting") restoreCmd.Flags().BoolP("quiet", "q", false, "suppress progress reporting") restoreCmd.Flags().String("recurse-submodules", "", "control recursive updating of submodules") - restoreCmd.Flags().BoolP("source", "s", false, " which tree-ish to checkout from") + restoreCmd.Flags().StringP("source", "s", "", "which tree-ish to checkout from") restoreCmd.Flags().BoolP("staged", "S", false, "restore the index") + restoreCmd.Flags().BoolP("theirs", "3", false, "checkout their version for unmerged files") restoreCmd.Flags().BoolP("worktree", "W", false, "restore the working tree (default)") rootCmd.AddCommand(restoreCmd) + + carapace.Gen(restoreCmd).FlagCompletion(carapace.ActionMap{ + "conflict": carapace.ActionValues("merge", "diff3"), + "pathspec-from-file": carapace.ActionFiles(""), + "recurse-submodules": action.ActionRefs(action.RefOptionDefault), + "source": action.ActionRefs(action.RefOptionDefault), + }) + + carapace.Gen(restoreCmd).PositionalAnyCompletion(action.ActionUnstagedChanges()) }