Skip to content

Commit

Permalink
added batdiff
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Apr 14, 2022
1 parent 7d09383 commit ffd6764
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
43 changes: 43 additions & 0 deletions completers/batdiff_completer/cmd/root.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package cmd

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

var rootCmd = &cobra.Command{
Use: "batdiff",
Short: "Diff a file against the current git index, or display the diff between two files",
Long: "https://github.com/eth-p/bat-extras/blob/master/doc/batdiff.md",
Run: func(cmd *cobra.Command, args []string) {},
}

func Execute() error {
return rootCmd.Execute()
}
func init() {
carapace.Gen(rootCmd).Standalone()

rootCmd.Flags().Bool("color", false, "Force color output.")
rootCmd.Flags().StringP("context", "C", "", "The number of lines to show before and after the differing lines.")
rootCmd.Flags().Bool("delta", false, "Display diffs using delta.")
rootCmd.Flags().Bool("no-color", false, "Force disable color output.")
rootCmd.Flags().String("pager", "", "Specify the pager to use.")
rootCmd.Flags().String("paging", "", "Enable/disable paging.")
rootCmd.Flags().String("terminal-width", "", "Generate output for the specified terminal width.")

carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
"pager": carapace.Batch(
os.ActionPathExecutables(),
carapace.ActionFiles(),
).ToA(),
"paging": carapace.ActionValues("always", "never").StyleF(style.ForKeyword),
})

carapace.Gen(rootCmd).PositionalCompletion(
carapace.ActionFiles(),
carapace.ActionFiles(),
)
}
7 changes: 7 additions & 0 deletions completers/batdiff_completer/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "github.com/rsteube/carapace-bin/completers/batdiff_completer/cmd"

func main() {
cmd.Execute()
}

0 comments on commit ffd6764

Please sign in to comment.