Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added freeze #2311

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions completers/freeze_completer/cmd/root.go
Original file line number Diff line number Diff line change
@@ -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(),
})
}
7 changes: 7 additions & 0 deletions completers/freeze_completer/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "github.com/carapace-sh/carapace-bin/completers/freeze_completer/cmd"

func main() {
cmd.Execute()
}