-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #188 from rsteube/add-git-restore
added git restore
- Loading branch information
Showing
1 changed file
with
19 additions
and
7 deletions.
There are no files selected for viewing
26 changes: 19 additions & 7 deletions
26
...rs/git_completer/cmd/restore_generated.go → completers/git_completer/cmd/restore.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) | ||
} |