Skip to content

Commit

Permalink
Merge pull request #329 from rsteube/git-add-difftool
Browse files Browse the repository at this point in the history
git: added difftool
  • Loading branch information
rsteube authored Mar 29, 2021
2 parents 2fb5ec3 + bdf71c3 commit b6e6f0f
Showing 1 changed file with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,37 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/rsteube/carapace-bin/pkg/actions/git"
"github.com/spf13/cobra"
)

var difftoolCmd = &cobra.Command{
Use: "difftool",
Short: "Show changes using common diff tools",
Run: func(cmd *cobra.Command, args []string) {
},
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(difftoolCmd).Standalone()

difftoolCmd.Flags().BoolP("dir-diff", "d", false, "perform a full-directory diff")
difftoolCmd.Flags().StringP("extcmd", "x", "", "specify a custom command for viewing diffs")
difftoolCmd.Flags().BoolP("gui", "g", false, "use `diff.guitool` instead of `diff.tool`")
difftoolCmd.Flags().Bool("no-index", false, "passed to `diff`")
difftoolCmd.Flags().BoolP("no-prompt", "y", false, "do not prompt before launching a diff tool")
difftoolCmd.Flags().Bool("symlinks", false, "use symlinks in dir-diff mode")
difftoolCmd.Flags().StringP("tool", "t", "", "use the specified diff tool")
difftoolCmd.Flags().Bool("tool-help", false, "print a list of diff tools that may be used with `--tool`")
difftoolCmd.Flags().Bool("trust-exit-code", false, "make 'git-difftool' exit when an invoked diff tool returns a non - zero exit code")
difftoolCmd.Flags().BoolP("tool", "t", false, "<tool> use the specified diff tool")
difftoolCmd.Flags().BoolP("extcmd", "x", false, "<command> specify a custom command for viewing diffs")
difftoolCmd.Flags().BoolP("no-prompt", "y", false, "do not prompt before launching a diff tool")
difftoolCmd.Flags().Bool("trust-exit-code", false, "exit when an invoked diff tool returns a non - zero exit code")
rootCmd.AddCommand(difftoolCmd)

carapace.Gen(difftoolCmd).FlagCompletion(carapace.ActionMap{
"tool": carapace.ActionFiles(),
})

carapace.Gen(difftoolCmd).PositionalCompletion(
git.ActionRefs(git.RefOptionDefault),
git.ActionRefs(git.RefOptionDefault),
)
}

0 comments on commit b6e6f0f

Please sign in to comment.