-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
5 deletions.
There are no files selected for viewing
36 changes: 31 additions & 5 deletions
36
...ters/git_completer/cmd/reset_generated.go → completers/git_completer/cmd/reset.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,27 +1,53 @@ | ||
package cmd | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/rsteube/carapace" | ||
"github.com/rsteube/carapace-bin/completers/git_completer/cmd/action" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var resetCmd = &cobra.Command{ | ||
Use: "reset", | ||
Short: "Reset current HEAD to the specified state", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
}, | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(resetCmd).Standalone() | ||
|
||
resetCmd.Flags().Bool("hard", false, "reset HEAD, index and working tree") | ||
resetCmd.Flags().BoolP("intent-to-add", "N", false, "record only the fact that removed paths will be added later") | ||
resetCmd.Flags().Bool("keep", false, "reset HEAD but keep local changes") | ||
resetCmd.Flags().Bool("merge", false, "reset HEAD, index and working tree") | ||
resetCmd.Flags().Bool("mixed", false, "reset HEAD and index") | ||
resetCmd.Flags().BoolP("intent-to-add", "N", false, "record only the fact that removed paths will be added later") | ||
resetCmd.Flags().Bool("pathspec-file-nul", false, "with --pathspec-from-file, pathspec elements are separated with NUL character") | ||
resetCmd.Flags().String("pathspec-from-file", "", "read pathspec from file") | ||
resetCmd.Flags().BoolP("patch", "p", false, "select hunks interactively") | ||
resetCmd.Flags().Bool("pathspec-file-nul", false, "pathspec elements are separated with NUL character") | ||
resetCmd.Flags().String("pathspec-from-file", "", "read pathspec from file") | ||
resetCmd.Flags().BoolP("quiet", "q", false, "be quiet, only report errors") | ||
resetCmd.Flags().String("recurse-submodules", "", "control recursive updating of submodules") | ||
resetCmd.Flags().Bool("soft", false, "reset only HEAD") | ||
rootCmd.AddCommand(resetCmd) | ||
|
||
resetCmd.Flag("recurse-submodules").NoOptDefVal = " " | ||
|
||
carapace.Gen(resetCmd).FlagCompletion(carapace.ActionMap{ | ||
"pathspec-from-file": carapace.ActionFiles(""), | ||
}) | ||
|
||
carapace.Gen(resetCmd).PositionalCompletion( | ||
action.ActionRefs(action.RefOptionDefault), | ||
) | ||
|
||
carapace.Gen(resetCmd).PositionalAnyCompletion( | ||
carapace.ActionCallback(func(args []string) carapace.Action { | ||
for _, arg := range os.Args { | ||
if arg == "--" { | ||
return carapace.ActionFiles("") | ||
} | ||
} | ||
return carapace.ActionValues() | ||
}), | ||
) | ||
} |