From e4daece43bd804d25dd509a6f1f4ba662013a9ae Mon Sep 17 00:00:00 2001 From: rsteube Date: Thu, 28 Mar 2024 21:35:49 +0100 Subject: [PATCH] added freeze --- completers/freeze_completer/cmd/root.go | 61 +++++++++++++++++++++++++ completers/freeze_completer/main.go | 7 +++ 2 files changed, 68 insertions(+) create mode 100644 completers/freeze_completer/cmd/root.go create mode 100644 completers/freeze_completer/main.go diff --git a/completers/freeze_completer/cmd/root.go b/completers/freeze_completer/cmd/root.go new file mode 100644 index 0000000000..1f89baa8d5 --- /dev/null +++ b/completers/freeze_completer/cmd/root.go @@ -0,0 +1,61 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/carapace-sh/carapace-bin/pkg/actions/color" + "github.com/carapace-sh/carapace-bin/pkg/actions/os" + "github.com/carapace-sh/carapace-bin/pkg/actions/tools/chroma" + "github.com/carapace-sh/carapace-bridge/pkg/actions/bridge" + "github.com/spf13/cobra" +) + +var rootCmd = &cobra.Command{ + Use: "freeze", + Short: "Generate images of code and terminal output", + Long: "https://github.com/charmbracelet/freeze", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func Execute() error { + return rootCmd.Execute() +} +func init() { + carapace.Gen(rootCmd).Standalone() + + rootCmd.Flags().StringP("background", "b", "", "Apply a background fill") + rootCmd.Flags().String("border.color", "", "Border color") + rootCmd.Flags().StringP("border.radius", "r", "", "Corner radius of window") + rootCmd.Flags().String("border.width", "", "Border width thickness") + rootCmd.Flags().StringP("config", "c", "", "Base configuration file or template") + rootCmd.Flags().StringP("execute", "x", "", "Capture output of command execution") + rootCmd.Flags().String("font.family", "", "Font family to use for code") + rootCmd.Flags().String("font.file", "", "Font file to embed") + rootCmd.Flags().Bool("font.ligatures", false, "Use ligatures in the font") + rootCmd.Flags().String("font.size", "", "Font size to use for code") + rootCmd.Flags().StringP("height", "H", "", "Height of terminal window") + rootCmd.Flags().BoolP("interactive", "i", false, "Use an interactive form for configuration options") + rootCmd.Flags().StringP("language", "l", "", "Language of code file") + rootCmd.Flags().String("line-height", "", "Line height relative to font size") + rootCmd.Flags().String("lines", "", "Lines to capture (start,end)") + rootCmd.Flags().StringP("margin", "m", "", "Apply margin to the window") + rootCmd.Flags().StringP("output", "o", "", "Output location for .svg, .png, or .webp") + rootCmd.Flags().StringP("padding", "p", "", "Apply padding to the code") + rootCmd.Flags().String("shadow.blur", "", "Shadow Gaussian Blur") + rootCmd.Flags().String("shadow.x", "", "Shadow offset x coordinate") + rootCmd.Flags().String("shadow.y", "", "Shadow offset y coordinate") + rootCmd.Flags().Bool("show-line-numbers", false, "Show line numbers") + rootCmd.Flags().StringP("theme", "t", "", "Theme to use for syntax highlighting") + rootCmd.Flags().StringP("width", "W", "", "Width of terminal window") + rootCmd.Flags().Bool("window", false, "Display window controls") + + carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{ + "background": color.ActionHexColors(), + "config": carapace.ActionFiles(), + "execute": bridge.ActionCarapaceBin().Split(), + "font.family": os.ActionFontFamilies(), + "font.file": carapace.ActionFiles(), + "language": chroma.ActionLexers(), + "output": carapace.ActionFiles(), + "theme": chroma.ActionStyles(), + }) +} diff --git a/completers/freeze_completer/main.go b/completers/freeze_completer/main.go new file mode 100644 index 0000000000..db92e1ae38 --- /dev/null +++ b/completers/freeze_completer/main.go @@ -0,0 +1,7 @@ +package main + +import "github.com/carapace-sh/carapace-bin/completers/freeze_completer/cmd" + +func main() { + cmd.Execute() +}