rsteube cc9d12b1fd readded macro os.PathExecutables as executables
moved/renamed `os.ActionPathExecutables` to `carapace.ActionExecutables`
2023-04-09 17:43:24 +02:00

40 lines
1.4 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package cmd
import (
"github.com/rsteube/carapace"
"github.com/rsteube/carapace-bin/pkg/actions/tools/git"
"github.com/spf13/cobra"
)
var mergetoolCmd = &cobra.Command{
Use: "mergetool",
Short: "Run merge conflict resolution tools to resolve merge conflicts",
Run: func(cmd *cobra.Command, args []string) {},
GroupID: groups[group_manipulator].ID,
}
func init() {
carapace.Gen(mergetoolCmd).Standalone()
mergetoolCmd.Flags().BoolP("gui", "g", false, "Read from the configured merge.guitool variable instead of merge.tool.")
mergetoolCmd.Flags().Bool("no-gui", false, "This overrides a previous -g or --gui setting")
mergetoolCmd.Flags().BoolP("no-prompt", "y", false, "Dont prompt before each invocation of the merge resolution program")
mergetoolCmd.Flags().Bool("prompt", false, "Prompt before each invocation of the merge resolution program to give the user a chance to skip the path")
mergetoolCmd.Flags().String("tool", "", "Use the merge resolution program specified by <tool>")
mergetoolCmd.Flags().Bool("tool-help", false, "Print a list of merge tools that may be used with --tool")
rootCmd.AddCommand(mergetoolCmd)
mergetoolCmd.Flag("tool").NoOptDefVal = " "
carapace.Gen(mergetoolCmd).FlagCompletion(carapace.ActionMap{
"tool": carapace.Batch(
carapace.ActionExecutables(),
carapace.ActionFiles(),
).ToA(),
})
carapace.Gen(mergetoolCmd).PositionalAnyCompletion(
git.ActionUnmergedFiles(),
)
}