Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added git restore #188

Merged
merged 1 commit into from
Oct 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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, "<tree-ish> 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())
}