From ab9133805da9445e1c33987381a3a70abc708404 Mon Sep 17 00:00:00 2001 From: rsteube Date: Wed, 11 May 2022 19:57:59 +0200 Subject: [PATCH] added go-carpet --- completers/go-carpet_completer/cmd/root.go | 35 ++++++++++++++++++++++ completers/go-carpet_completer/main.go | 7 +++++ 2 files changed, 42 insertions(+) create mode 100644 completers/go-carpet_completer/cmd/root.go create mode 100644 completers/go-carpet_completer/main.go diff --git a/completers/go-carpet_completer/cmd/root.go b/completers/go-carpet_completer/cmd/root.go new file mode 100644 index 0000000000..e6624969b3 --- /dev/null +++ b/completers/go-carpet_completer/cmd/root.go @@ -0,0 +1,35 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var rootCmd = &cobra.Command{ + Use: "go-carpet", + Short: "show test coverage for Go source files", + Long: "https://github.com/msoap/go-carpet", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func Execute() error { + return rootCmd.Execute() +} +func init() { + carapace.Gen(rootCmd).Standalone() + + rootCmd.Flags().Bool("256colors", false, "use more colors on 256-color terminal") + rootCmd.Flags().String("args", "", "pass additional arguments for go test") + rootCmd.Flags().String("file", "", "comma-separated list of files to test") + rootCmd.Flags().String("func", "", "comma-separated functions list") + rootCmd.Flags().Bool("include-vendor", false, "include vendor directories for show coverage") + rootCmd.Flags().Bool("summary", false, "only show summary for each file") + rootCmd.Flags().Bool("version", false, "get version") + + carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{ + "file": carapace.ActionMultiParts(",", func(c carapace.Context) carapace.Action { + return carapace.ActionFiles() + }), + // TODO complete funcs + }) +} diff --git a/completers/go-carpet_completer/main.go b/completers/go-carpet_completer/main.go new file mode 100644 index 0000000000..5b96e7417c --- /dev/null +++ b/completers/go-carpet_completer/main.go @@ -0,0 +1,7 @@ +package main + +import "github.com/rsteube/carapace-bin/completers/go-carpet_completer/cmd" + +func main() { + cmd.Execute() +}