added ghostty

This commit is contained in:
rsteube 2024-12-27 18:12:04 +01:00
parent 9b91942638
commit 591a203a49
28 changed files with 861 additions and 0 deletions

View File

@ -0,0 +1,19 @@
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)
var crashReportCmd = &cobra.Command{
Use: "+crash-report",
Short: "inspect and send crash report",
Run: func(cmd *cobra.Command, args []string) {},
}
func init() {
carapace.Gen(crashReportCmd).Standalone()
crashReportCmd.Flags().Bool("help", false, "show help")
rootCmd.AddCommand(crashReportCmd)
}

View File

@ -0,0 +1,18 @@
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)
var helpCmd = &cobra.Command{
Use: "+help",
Short: "show help",
Run: func(cmd *cobra.Command, args []string) {},
}
func init() {
carapace.Gen(helpCmd).Standalone()
rootCmd.AddCommand(helpCmd)
}

View File

@ -0,0 +1,20 @@
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)
var listActionsCmd = &cobra.Command{
Use: "+list-actions",
Short: "list all the available keybind actions for Ghostty",
Run: func(cmd *cobra.Command, args []string) {},
}
func init() {
carapace.Gen(listActionsCmd).Standalone()
listActionsCmd.Flags().Bool("docs", false, "print out the documentation for each action")
listActionsCmd.Flags().Bool("help", false, "show help")
rootCmd.AddCommand(listActionsCmd)
}

View File

@ -0,0 +1,19 @@
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)
var listColorsCmd = &cobra.Command{
Use: "+list-colors",
Short: "list all the named RGB colors in Ghostty",
Run: func(cmd *cobra.Command, args []string) {},
}
func init() {
carapace.Gen(listColorsCmd).Standalone()
listColorsCmd.Flags().Bool("help", false, "show help")
rootCmd.AddCommand(listColorsCmd)
}

View File

@ -0,0 +1,27 @@
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/os"
"github.com/spf13/cobra"
)
var listFontsCmd = &cobra.Command{
Use: "+list-fonts",
Short: "list all the available fonts for Ghostty",
Run: func(cmd *cobra.Command, args []string) {},
}
func init() {
carapace.Gen(listFontsCmd).Standalone()
listFontsCmd.Flags().Bool("bold", false, "filter results to bold style")
listFontsCmd.Flags().String("family", "", "filter results to a specific family")
listFontsCmd.Flags().Bool("help", false, "show help")
listFontsCmd.Flags().Bool("italic", false, "filter results to italic style")
rootCmd.AddCommand(listFontsCmd)
carapace.Gen(listFontsCmd).FlagCompletion(carapace.ActionMap{
"family": os.ActionFontFamilies(),
})
}

View File

@ -0,0 +1,20 @@
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)
var listKeybindsCmd = &cobra.Command{
Use: "+list-keybinds",
Short: "list all the available keybinds",
Run: func(cmd *cobra.Command, args []string) {},
}
func init() {
carapace.Gen(listKeybindsCmd).Standalone()
listKeybindsCmd.Flags().Bool("default", false, "print out all the default keybinds")
listKeybindsCmd.Flags().Bool("plain", false, "disable formatting")
rootCmd.AddCommand(listKeybindsCmd)
}

View File

@ -0,0 +1,21 @@
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)
var listThemesCmd = &cobra.Command{
Use: "+list-themes",
Short: "preview or list all the available themes for Ghostty",
Run: func(cmd *cobra.Command, args []string) {},
}
func init() {
carapace.Gen(listThemesCmd).Standalone()
listThemesCmd.Flags().Bool("help", false, "show help")
listThemesCmd.Flags().Bool("path", false, "Show the full path to the theme")
listThemesCmd.Flags().Bool("plain", false, "Force a plain listing of themes")
rootCmd.AddCommand(listThemesCmd)
}

View File

@ -0,0 +1,238 @@
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/ghostty"
"github.com/carapace-sh/carapace-bridge/pkg/actions/bridge"
"github.com/carapace-sh/carapace/pkg/style"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "ghostty",
Short: "a fast, feature-rich, and cross-platform terminal emulator ",
Long: "https://ghostty.org/",
Run: func(cmd *cobra.Command, args []string) {},
}
func Execute() error {
return rootCmd.Execute()
}
func init() {
carapace.Gen(rootCmd).Standalone()
rootCmd.Flags().StringS("e", "e", "", "run command")
rootCmd.Flags().Bool("help", false, "show help")
rootCmd.Flags().Bool("version", false, "show version")
addConfigs(rootCmd)
carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
"e": bridge.ActionCarapaceBin().Split(),
})
}
func addConfigs(cmd *cobra.Command) {
cmd.Flags().Bool("_xdg-terminal-exec", false, "Set to true if Ghostty was executed as xdg-terminal-exec on Linux")
cmd.Flags().String("abnormal-command-exit-runtime", "", "The number of milliseconds of runtime below which we consider a process exit to be abnormal")
cmd.Flags().String("adjust-box-thickness", "", "Thickness in pixels of box drawing characters")
cmd.Flags().String("adjust-cell-height", "", "Height of the cell")
cmd.Flags().String("adjust-cell-width", "", "Witdth of the cell")
cmd.Flags().String("adjust-cursor-height", "", "Height in pixels of the cursor")
cmd.Flags().String("adjust-cursor-thickness", "", "Thickness in pixels of the bar cursor and outlined rect cursor")
cmd.Flags().String("adjust-font-baseline", "", "Distance in pixels from the bottom of the cell to the text baseline")
cmd.Flags().String("adjust-overline-position", "", "Distance in pixels from the top of the cell to the top of the overline")
cmd.Flags().String("adjust-overline-thickness", "", "Thickness in pixels of the overline")
cmd.Flags().String("adjust-strikethrough-position", "", "Distance in pixels from the top of the cell to the top of the strikethrough")
cmd.Flags().String("adjust-strikethrough-thickness", "", "Thickness in pixels of the strikethrough")
cmd.Flags().String("adjust-underline-position", "", "Distance in pixels from the top of the cell to the top of the underline")
cmd.Flags().String("adjust-underline-thickness", "", "Thickness in pixels of the underline")
cmd.Flags().String("adw-toolbar-style", "", "Determines the appearance of the top and bottom bars when using the Adwaita tab bar")
cmd.Flags().String("auto-update", "", "Control the auto-update functionality of Ghostty")
cmd.Flags().String("auto-update-channel", "", "The release channel to use for auto-updates")
cmd.Flags().String("background-blur-radius", "", "A positive value enables blurring of the background when background-opacity is less than 1")
cmd.Flags().String("background-opacity", "", "The opacity level (opposite of transparency) of the background")
cmd.Flags().Bool("bold-is-bright", false, "If `true`, the bold text will use the bright color palette")
cmd.Flags().String("click-repeat-interval", "", "The time in milliseconds between clicks to consider a click a repeat")
cmd.Flags().Bool("clipboard-paste-bracketed-safe", false, "If true, bracketed pastes will be considered safe")
cmd.Flags().Bool("clipboard-paste-protection", false, "Require confirmation before pasting text that appears unsafe")
cmd.Flags().String("clipboard-read", "", "Whether to allow programs running in the terminal to read from the system clipboard")
cmd.Flags().Bool("clipboard-trim-trailing-spaces", false, "Trims trailing whitespace on data that is copied to the clipboard")
cmd.Flags().String("clipboard-write", "", "Whether to allow programs running in the terminal to write to the system clipboard")
cmd.Flags().Bool("config-default-files", false, "When this is true, the default configuration file paths will be loaded")
cmd.Flags().StringArray("config-file", nil, "Additional configuration files to read")
cmd.Flags().Bool("confirm-close-surface", false, "Confirms that a surface should be closed before closing it")
cmd.Flags().String("copy-on-select", "", "Whether to automatically copy selected text to the clipboard")
cmd.Flags().Bool("cursor-click-to-move", false, "Enables the ability to move the cursor at prompts")
cmd.Flags().String("cursor-color", "", "The color of the cursor")
cmd.Flags().Bool("cursor-invert-fg-bg", false, "Swap the foreground and background colors of the cell under the cursor")
cmd.Flags().String("cursor-opacity", "", "The opacity level (opposite of transparency) of the cursor")
cmd.Flags().String("cursor-style", "", "The style of the cursor")
cmd.Flags().Bool("cursor-style-blink", false, "Sets the default blinking state of the cursor")
cmd.Flags().String("cursor-text", "", "The color of the text under the cursor")
cmd.Flags().StringArray("custom-shader", nil, "Custom shaders to run after the default shaders")
cmd.Flags().String("custom-shader-animation", "", "Controls when custom shaders are animated")
cmd.Flags().Bool("desktop-notifications", false, "bool")
cmd.Flags().String("enquiry-response", "", "String to send when we receive `ENQ` (`0x05`) from the command that we are running")
cmd.Flags().Bool("focus-follows-mouse", false, "If true, when there are multiple split panes, the mouse selects the pane that is focused")
cmd.Flags().StringArray("font-codepoint-map", nil, "Force one or a range of Unicode codepoints to map to a specific named font")
cmd.Flags().StringArray("font-family", nil, "The font families to use")
cmd.Flags().StringArray("font-family-bold", nil, "The font families to use for bold")
cmd.Flags().StringArray("font-family-bold-italic", nil, "The font families to use for bold italic")
cmd.Flags().StringArray("font-family-italic", nil, "The font families to use for italic")
cmd.Flags().StringArray("font-feature", nil, "Apply a font feature")
cmd.Flags().String("font-size", "", "Font size in points")
cmd.Flags().String("font-style", "", "The named font style to use")
cmd.Flags().String("font-style-bold", "", "The named font style to use for bold")
cmd.Flags().String("font-style-bold-italic", "", "The named font style to use for bold italic")
cmd.Flags().String("font-style-italic", "", "The named font style to use for italic")
cmd.Flags().String("font-synthetic-style", "", "Control whether Ghostty should synthesize a style if the requested style is not available")
cmd.Flags().Bool("font-thicken", false, "Draw fonts with a thicker stroke")
cmd.Flags().StringArray("font-variation", nil, "Set font variation")
cmd.Flags().StringArray("font-variation-bold", nil, "Set font variation for bold")
cmd.Flags().StringArray("font-variation-bold-italic", nil, "Set font variation for bold-italic")
cmd.Flags().StringArray("font-variation-italic", nil, "Set font variation for italic")
cmd.Flags().String("freetype-load-flags", "", "FreeType load flags to enable")
cmd.Flags().String("grapheme-width-method", "", "The method to use for calculating the cell width of a grapheme cluster")
cmd.Flags().Bool("gtk-adwaita", false, "Adwaita theme support")
cmd.Flags().String("gtk-single-instance", "", "Run in single-instance mode")
cmd.Flags().String("gtk-tabs-location", "", "Determines the side of the screen that the GTK tab bar will stick to")
cmd.Flags().Bool("gtk-titlebar", false, "Display the full GTK titlebar")
cmd.Flags().Bool("gtk-wide-tabs", false, "Use \"wide\" GTK tabs")
cmd.Flags().String("image-storage-limit", "", "The total amount of bytes that can be used for image data")
cmd.Flags().String("initial-command", "", "This is the same as \"command\", but only applies to the first terminal surface created")
cmd.Flags().Bool("initial-window", false, "Create an initial window when Ghostty is run")
cmd.Flags().Bool("link-url", false, "Enable URL matching")
cmd.Flags().String("linux-cgroup", "", "Put every surface (tab, split, window) into a dedicated Linux cgroup")
cmd.Flags().Bool("linux-cgroup-hard-fail", false, "Let cgroup initialization failure cause exit")
cmd.Flags().String("linux-cgroup-memory-limit", "", "Memory limit for any individual terminal process")
cmd.Flags().String("linux-cgroup-processes-limit", "", "Number of processes limit for any individual terminal process")
cmd.Flags().Bool("macos-auto-secure-input", false, "Automatically enable the \"Secure Input\" feature")
cmd.Flags().String("macos-icon", "", "Customize the macOS app icon")
cmd.Flags().String("macos-icon-frame", "", "The material to use for the frame of the macOS app icon")
cmd.Flags().String("macos-icon-ghost-color", "", "The color of the ghost in the macOS app icon")
cmd.Flags().String("macos-icon-screen-color", "", "The color of the screen in the macOS app icon")
cmd.Flags().String("macos-non-native-fullscreen", "", "Non-native fullscreen mode")
cmd.Flags().String("macos-option-as-alt", "", "Treat option key as alt")
cmd.Flags().Bool("macos-secure-input-indication", false, "Show a graphical indication when secure input is enabled")
cmd.Flags().String("macos-titlebar-proxy-icon", "", "Whether the proxy icon in the macOS titlebar is visible")
cmd.Flags().String("macos-titlebar-style", "", "The style of the macOS titlebar")
cmd.Flags().Bool("macos-window-shadow", false, "Whether to enable the macOS window shadow")
cmd.Flags().String("minimum-contrast", "", "The minimum contrast ratio between the foreground and background colors")
cmd.Flags().Bool("mouse-hide-while-typing", false, "Hide the mouse immediately when typing")
cmd.Flags().String("mouse-scroll-multiplier", "", "Multiplier for scrolling distance with the mouse wheel")
cmd.Flags().String("mouse-shift-capture", "", "Determines whether running programs can detect the shift key pressed with a mouse click")
cmd.Flags().String("osc-color-report-format", "", "Sets the reporting format for OSC sequences that request color information")
cmd.Flags().String("quick-terminal-animation-duration", "", "Duration (in seconds) of the quick terminal enter and exit animation")
cmd.Flags().Bool("quick-terminal-autohide", false, "Automatically hide the quick terminal when focus shifts to another window")
cmd.Flags().String("quick-terminal-position", "", "The position of the \"quick\" terminal window")
cmd.Flags().String("quick-terminal-screen", "", "The screen where the quick terminal should show up")
cmd.Flags().Bool("quit-after-last-window-closed", false, "Whether or not to quit after the last surface is closed")
cmd.Flags().String("quit-after-last-window-closed-delay", "", "Controls how long Ghostty will stay running after the last open surface has been closed")
cmd.Flags().String("resize-overlay", "", "Controls when resize overlays are shown")
cmd.Flags().String("resize-overlay-duration", "", "Controls how long the overlay is visible on the screen before it is hidde")
cmd.Flags().String("resize-overlay-position", "", "Controls the position of the overlay")
cmd.Flags().String("scrollback-limit", "", "The size of the scrollback buffer in bytes")
cmd.Flags().String("selection-background", "", "The background color for selection")
cmd.Flags().String("selection-foreground", "", "The foreground color for selection")
cmd.Flags().Bool("selection-invert-fg-bg", false, "Swap the foreground and background colors of cells for selection")
cmd.Flags().String("shell-integration", "", "Whether to enable shell integration auto-injection or not")
cmd.Flags().String("shell-integration-features", "", "Shell integration features to enable")
cmd.Flags().String("unfocused-split-fill", "", "The color to dim the unfocused split")
cmd.Flags().String("unfocused-split-opacity", "", "The opacity level (opposite of transparency) of an unfocused split")
cmd.Flags().Bool("vt-kam-allowed", false, "Allows the \"KAM\" mode")
cmd.Flags().Bool("wait-after-command", false, "Keep the terminal open after the command exits")
cmd.Flags().String("window-colorspace", "", "The colorspace to use for the terminal window")
cmd.Flags().Bool("window-decoration", false, "Enable window decorations")
cmd.Flags().String("window-height", "", "The initial window height")
cmd.Flags().Bool("window-inherit-font-size", false, "Inherit the font size of the previously focused window")
cmd.Flags().Bool("window-inherit-working-directory", false, "Inherit the working directory of the previously focused window")
cmd.Flags().String("window-new-tab-position", "", "The position where new tabs are created")
cmd.Flags().Bool("window-padding-balance", false, "The viewport dimensions are usually not perfectly divisible by the cell size")
cmd.Flags().String("window-padding-color", "", "The color of the padding area of the window")
cmd.Flags().String("window-padding-x", "", "Horizontal window padding")
cmd.Flags().String("window-padding-y", "", "Vertical window padding")
cmd.Flags().String("window-save-state", "", "Whether to enable saving and restoring window state")
cmd.Flags().Bool("window-step-resize", false, "Resize the window in discrete increments of the focused surface's cell size")
cmd.Flags().String("window-theme", "", "The theme to use for the windows")
cmd.Flags().String("window-title-font-family", "", "The font that will be used for the application's window and tab titles")
cmd.Flags().Bool("window-vsync", false, "Synchronize rendering with the screen refresh rate")
cmd.Flags().String("window-width", "", "The initial window width")
cmd.Flags().String("working-directory", "", "The directory to change to after starting the command")
cmd.Flags().String("x11-instance-name", "", "This controls the instance name field of the `WM_CLASS` X11 property")
// TODO use font-families from `+list-fonts`?
carapace.Gen(cmd).FlagCompletion(carapace.ActionMap{
"adw-toolbar-style": ghostty.ActionAdwToolbarStyles(),
"auto-update": ghostty.ActionAutoUpdateModes(),
"auto-update-channel": ghostty.ActionReleaseChannels(),
"clipboard-read": carapace.ActionValues("ask", "allow", "deny").StyleF(style.ForKeyword),
"clipboard-write": carapace.ActionValues("ask", "allow", "deny").StyleF(style.ForKeyword),
"config-file": carapace.ActionFiles(),
"copy-on-select": ghostty.ActionCopyOnSelectModes(),
"cursor-color": color.ActionHexColors(),
"cursor-style": ghostty.ActionCursorStyles(),
"cursor-text": color.ActionHexColors(),
"custom-shader": carapace.ActionFiles(),
"custom-shader-animation": ghostty.ActionShaderAnimationModes(),
"font-codepoint-map": carapace.ActionMultiPartsN("=", 2, func(c carapace.Context) carapace.Action {
switch len(c.Parts) {
case 0:
return carapace.ActionValues() // TODO codepoint
default:
return os.ActionFontFamilies()
}
}),
"font-family": os.ActionFontFamilies(),
"font-family-bold": os.ActionFontFamilies(),
"font-family-bold-italic": os.ActionFontFamilies(),
"font-family-italic": os.ActionFontFamilies(),
"font-feature": carapace.ActionValues(), // TODO font-features
"font-style": carapace.ActionValues(), // TODO font style
"font-style-bold": carapace.ActionValues(), // TODO font style
"font-style-bold-italic": carapace.ActionValues(), // TODO font style
"font-style-italic": carapace.ActionValues(), // TODO font style
"font-synthetic-style": ghostty.ActionFontSyntheticStyles().UniqueList(","),
"font-variation": carapace.ActionValues(), // TODO font variation
"font-variation-bold": carapace.ActionValues(), // TODO font variation
"font-variation-bold-italic": carapace.ActionValues(), // TODO font variation
"font-variation-italic": carapace.ActionValues(), // TODO font variation
"freetype-load-flags": ghostty.ActionFreetypeLoadFlags().UniqueList(","),
"grapheme-width-method": ghostty.ActionGraphemeWidthMethods(),
"gtk-single-instance": carapace.ActionValues("true", "false", "detect").StyleF(style.ForKeyword),
"gtk-tabs-location": carapace.ActionValues("top", "bottom", "left", "right", "hidden"),
"initial-command": bridge.ActionCarapaceBin().Split(),
"linux-cgroup": carapace.ActionValuesDescribed(
"never", "Never use cgroups",
"always", "Always use cgroups",
"single-instance", "Enable cgroups only for Ghostty instances launched",
).StyleF(style.ForKeyword),
"macos-icon": ghostty.ActionMacIcons(),
"macos-icon-frame": ghostty.ActionMacIconFrames(),
"macos-icon-ghost-color": color.ActionHexColors(),
"macos-icon-screen-color": color.ActionHexColors().List(","),
"macos-non-native-fullscreen": ghostty.ActionMacFullscreenModes(),
"macos-option-as-alt": carapace.ActionValues("false", "true", "left", "right").StyleF(style.ForKeyword),
"macos-titlebar-proxy-icon": carapace.ActionValues("visible", "hidden"),
"macos-titlebar-style": ghostty.ActionMacTitlebarStyles(),
"mouse-shift-capture": ghostty.ActionMouseShiftCaptureModes(),
"osc-color-report-format": ghostty.ActionOscColorReportFormats(),
"quick-terminal-position": ghostty.ActionQuickTerminalPositions(),
"quick-terminal-screen": ghostty.ActionQuickTerminalScreens(),
"resize-overlay": ghostty.ActionResizeOverlayModes(),
"resize-overlay-position": ghostty.ActionResizeOverlayPositions(),
"selection-background": color.ActionHexColors(),
"selection-foreground": color.ActionHexColors(),
"shell-integration": ghostty.ActionShellIntegrationModes(),
"shell-integration-features": ghostty.ActionShellIntegrationFeatures().UniqueList(","),
"unfocused-split-fill": color.ActionXtermColorNames(),
"window-colorspace": carapace.ActionValues("srgb", "display-p3"),
"window-new-tab-position": ghostty.ActionWindowNewTabPositions(),
"window-padding-color": ghostty.ActionWindowPaddingColors(),
"window-save-state": ghostty.ActionWindowSaveStates(),
"window-theme": ghostty.ActionWindowThemes(),
"window-title-font-family": os.ActionFontFamilies(),
"working-directory": carapace.ActionDirectories(),
})
}

View File

@ -0,0 +1,22 @@
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)
var showConfigCmd = &cobra.Command{
Use: "+show-config",
Short: "show the current configuration",
Run: func(cmd *cobra.Command, args []string) {},
}
func init() {
carapace.Gen(showConfigCmd).Standalone()
showConfigCmd.Flags().Bool("changes-only", false, "Only show the options that have been changed")
showConfigCmd.Flags().Bool("default", false, "Show the default configuration")
showConfigCmd.Flags().Bool("docs", false, "Print the documentation above each option as a comment")
showConfigCmd.Flags().Bool("help", false, "show help")
rootCmd.AddCommand(showConfigCmd)
}

View File

@ -0,0 +1,28 @@
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)
var showFaceCmd = &cobra.Command{
Use: "+show-face",
Short: "show what font face Ghostty will use to render a specific codepoint",
Run: func(cmd *cobra.Command, args []string) {},
}
func init() {
carapace.Gen(showFaceCmd).Standalone()
showFaceCmd.Flags().String("cp", "", "Find the face for a single codepoint")
showFaceCmd.Flags().Bool("help", false, "show help")
showFaceCmd.Flags().String("presentation", "", "force searching for a specific presentation style")
showFaceCmd.Flags().String("string", "", "Find the face for all of the codepoints in a string")
showFaceCmd.Flags().String("style", "", "Search for a specific style")
rootCmd.AddCommand(showFaceCmd)
carapace.Gen(showFaceCmd).FlagCompletion(carapace.ActionMap{
"presentation": carapace.ActionValues("text", "emoji"),
"style": carapace.ActionValues("regular", "bold", "italic", "bold_italic"),
})
}

View File

@ -0,0 +1,24 @@
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)
var validateConfigCmd = &cobra.Command{
Use: "+validate-config",
Short: "validate a Ghostty config file",
Run: func(cmd *cobra.Command, args []string) {},
}
func init() {
carapace.Gen(validateConfigCmd).Standalone()
validateConfigCmd.Flags().String("config-file", "", "validate a specific target config file")
validateConfigCmd.Flags().Bool("help", false, "show help")
rootCmd.AddCommand(validateConfigCmd)
carapace.Gen(validateConfigCmd).FlagCompletion(carapace.ActionMap{
"config-file": carapace.ActionFiles(),
})
}

View File

@ -0,0 +1,18 @@
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)
var versionCmd = &cobra.Command{
Use: "+version",
Short: "show version",
Run: func(cmd *cobra.Command, args []string) {},
}
func init() {
carapace.Gen(versionCmd).Standalone()
rootCmd.AddCommand(versionCmd)
}

View File

@ -0,0 +1,7 @@
package main
import "github.com/carapace-sh/carapace-bin/completers/ghostty_completer/cmd"
func main() {
cmd.Execute()
}

20
pkg/actions/env/ghostty.go vendored Normal file
View File

@ -0,0 +1,20 @@
package env
import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/conditions"
)
func init() {
knownVariables["ghostty"] = func() variables {
return variables{
Condition: conditions.ConditionPath("ghostty"),
Variables: map[string]string{
"GHOSTTY_RESOURCES_DIR": "resources directory",
},
VariableCompletion: map[string]carapace.Action{
"GHOSTTY_RESOURCES_DIR": carapace.ActionDirectories(),
},
}
}
}

View File

@ -0,0 +1,16 @@
package ghostty
import "github.com/carapace-sh/carapace"
// ActionCursorStyles completes cursor styles
//
// block
// bar
func ActionCursorStyles() carapace.Action {
return carapace.ActionValues(
"block",
"bar",
"underline",
"block_hollow",
).Tag("cursor styles")
}

View File

@ -0,0 +1,37 @@
package ghostty
import "github.com/carapace-sh/carapace"
// ActionFontSyntheticStyles completes font synthetic styles
//
// false (completely disable)
// italic (apply a slant to the glyph)
func ActionFontSyntheticStyles() carapace.Action {
return carapace.ActionValuesDescribed(
"bold", "draw an outline around the glyph",
"bold-italic", "draw an outline and apply a slant to the glyph",
"false", "completely disable",
"italic", "apply a slant to the glyph",
"no-bold", "disable for bold",
"no-bold-italic", "disable for bold-italic",
"no-italic", "disable for italic",
"true", "completely enable",
)
}
// ActionFreetypeLoadFlags completes freetype load flags
//
// hinting (Enable hinting)
// force-autohint (Use the freetype auto-hinter)
func ActionFreetypeLoadFlags() carapace.Action {
return carapace.ActionValuesDescribed(
"hinting", "Enable hinting",
"force-autohint", "Use the freetype auto-hinter",
"monochrome", "use 1-bit monochrome rendering",
"autohint", "Use the freetype auto-hinter",
"no-hinting", "Disable hinting",
"no-force-autohint", "Do not se the freetype auto-hinter",
"no-monochrome", "Do not use 1-bit monochrome rendering",
"no-autohint", "Do not use the freetype auto-hinter",
)
}

View File

@ -0,0 +1,14 @@
package ghostty
import "github.com/carapace-sh/carapace"
// ActionGraphemeWidthMethods completes grapheme width methods
//
// legacy (Use a legacy method to determine grapheme width)
// unicode (Use the Unicode standard to determine grapheme width)
func ActionGraphemeWidthMethods() carapace.Action {
return carapace.ActionValuesDescribed(
"legacy", "Use a legacy method to determine grapheme width",
"unicode", "Use the Unicode standard to determine grapheme width",
)
}

View File

@ -0,0 +1,43 @@
package ghostty
import "github.com/carapace-sh/carapace"
// ActionMacIcons completes mac icons
func ActionMacIcons() carapace.Action {
return carapace.ActionValuesDescribed(
"official", "Use the official Ghostty icon",
"custom-style", "Use the official Ghostty icon but with custom styles",
).Tag("mac icons")
}
// ActionMacIconFrames completes mac icon frames
func ActionMacIconFrames() carapace.Action {
return carapace.ActionValues(
"aluminum", "A brushed aluminum frame. This is the default",
"beige", "A classic 90's computer beige frame",
"plastic", "A glossy, dark plastic frame",
"chrome", "A shiny chrome frame",
).Tag("mac icon frames")
}
// ActionMacFullscreenModes completes mac fullscreen modes
func ActionMacFullscreenModes() carapace.Action {
return carapace.ActionValuesDescribed(
"visible-menu", "Use non-native macOS fullscreen, keep the menu bar visible",
"true", "Use non-native macOS fullscreen, hide the menu bar",
"false", "Use native macOS fullscreen",
).Tag("mac fullscreen modes")
}
// ActionMacTitlebarStyles completes mac titlebar styles
//
// native (native macOS titlebar with zero customization)
// transparent (same as "native" but the titlebar will be transparent)
func ActionMacTitlebarStyles() carapace.Action {
return carapace.ActionValuesDescribed(
"native", "native macOS titlebar with zero customization",
"transparent", "same as \"native\" but the titlebar will be transparent",
"tabs", "custom titlebar that integrates the tab bar into the titlebar",
"hidden", "hides the titlebar",
).Tag("mac titlebar styles")
}

View File

@ -0,0 +1,16 @@
package ghostty
import "github.com/carapace-sh/carapace"
// ActionMouseShiftCaptureModes completes mouse shift capture modes
//
// always (always capture)
// never (never capture)
func ActionMouseShiftCaptureModes() carapace.Action {
return carapace.ActionValuesDescribed(
"true", "capture, but allow override",
"false", "don't capture, but allow override",
"always", "always capture",
"never", "never capture",
).Tag("mouse shift capture modes")
}

View File

@ -0,0 +1,15 @@
package ghostty
import "github.com/carapace-sh/carapace"
// ActionOscColorReportFormats completes osc color report formats
//
// none (OSC 4/10/11 queries receive no reply)
// 8-bit (Color components are return unscaled)
func ActionOscColorReportFormats() carapace.Action {
return carapace.ActionValuesDescribed(
"none", "OSC 4/10/11 queries receive no reply",
"8-bit", "Color components are return unscaled",
"16-bit", "Color components are returned scaled",
)
}

View File

@ -0,0 +1,29 @@
package ghostty
import "github.com/carapace-sh/carapace"
// ActionQuickTerminalPositions completes quick terminal positions
//
// top (Terminal appears at the top of the screen)
// bottom (Terminal appears at the bottom of the screen)
func ActionQuickTerminalPositions() carapace.Action {
return carapace.ActionValuesDescribed(
"top", "Terminal appears at the top of the screen",
"bottom", "Terminal appears at the bottom of the screen",
"left", "Terminal appears at the left of the screen",
"right", "Terminal appears at the right of the screen",
"center", "Terminal appears at the center of the screen",
).Tag("quick terminal positions")
}
// ActionQuickTerminalScreens completes quick terminal screens
//
// main (The screen that the operating system recommends as the main screen)
// mouse (The screen that the mouse is currently hovered over)
func ActionQuickTerminalScreens() carapace.Action {
return carapace.ActionValuesDescribed(
"main", "The screen that the operating system recommends as the main screen",
"mouse", "The screen that the mouse is currently hovered over",
"macos-menu-bar", "The screen that contains the macOS menu bar",
).Tag("quick terminal screens")
}

View File

@ -0,0 +1,31 @@
package ghostty
import "github.com/carapace-sh/carapace"
// ActionResizeOverlayModes completes resize overlay modes
//
// always (Always show resize overlays)
// never (Never show resize overlays)
func ActionResizeOverlayModes() carapace.Action {
return carapace.ActionValuesDescribed(
"always", "Always show resize overlays",
"never", "Never show resize overlays",
"after-first", "Show up if the surface is resized after creation",
).Tag("resize overlay modes")
}
// ActionResizeOverlayPositions completes resize overlay positions
//
// center
// top-left
func ActionResizeOverlayPositions() carapace.Action {
return carapace.ActionValuesDescribed(
"center",
"top-left",
"top-center",
"top-right",
"bottom-left",
"bottom-center",
"bottom-right",
).Tag("resize overlay positions")
}

View File

@ -0,0 +1,18 @@
package ghostty
import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace/pkg/style"
)
// ActionCopyOnSelectModes completes copy-on-select modes
//
// true (prefer to copy to the selection clipboard if supported by the OS)
// clipboard (always copy text to the selection clipboard)
func ActionCopyOnSelectModes() carapace.Action {
return carapace.ActionValuesDescribed(
"true", "prefer to copy to the selection clipboard if supported by the OS",
"clipboard", "always copy text to the selection clipboard",
"false", "do not automatically copy selected text to the clipboard",
).StyleF(style.ForKeyword).Tag("copy-on-select modes")
}

View File

@ -0,0 +1,18 @@
package ghostty
import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace/pkg/style"
)
// ActionShaderAnimationModes completes shader animation modes
//
// true (run an animation loop when custom shaders are used)
// false (only render when the terminal is updated)
func ActionShaderAnimationModes() carapace.Action {
return carapace.ActionValuesDescribed(
"true", "run an animation loop when custom shaders are used",
"false", "only render when the terminal is updated",
"always", "run the animation loop regardless of whether the terminal is focused or not",
).StyleF(style.ForKeyword).Tag("shader animation modes")
}

View File

@ -0,0 +1,30 @@
package ghostty
import "github.com/carapace-sh/carapace"
// ActionShellIntegrationModes completes shell integration modes
//
// none (Do not do any automatic injection)
// detect (Detect the shell based on the filename)
func ActionShellIntegrationModes() carapace.Action {
return carapace.ActionValuesDescribed(
"none", "Do not do any automatic injection",
"detect", "Detect the shell based on the filename",
"bash", "",
"elvish", "",
"fish", "",
"zsh", "",
).Tag("shell integration modes")
}
// ActionShellIntegrationFeatures completes shell integration features
//
// cursor (Set the cursor to a blinking bar at the prompt)
// sudo (Set sudo wrapper to preserve terminfo)
func ActionShellIntegrationFeatures() carapace.Action {
return carapace.ActionValuesDescribed(
"cursor", "Set the cursor to a blinking bar at the prompt",
"sudo", "Set sudo wrapper to preserve terminfo",
"title", "Set the window title via shell integration",
).Tag("shell integration features")
}

View File

@ -0,0 +1,15 @@
package ghostty
import "github.com/carapace-sh/carapace"
// ActionAdwToolbarStyles completes adw toolbar styles
//
// flat (Top and bottom bars are flat with the terminal window)
// raised (Top and bottom bars cast a shadow on the terminal area)
func ActionAdwToolbarStyles() carapace.Action {
return carapace.ActionValuesDescribed(
"flat", "Top and bottom bars are flat with the terminal window",
"raised", "Top and bottom bars cast a shadow on the terminal area",
"raised-border", "Similar to `raised` but the shadow is replaced with a more subtle border",
).Tag("adw toolbar styles")
}

View File

@ -0,0 +1,26 @@
package ghostty
import "github.com/carapace-sh/carapace"
// ActionAutoUpdateModes completes auto update modes
//
// off (Disable auto-updates)
// check (Check for updates)
func ActionAutoUpdateModes() carapace.Action {
return carapace.ActionValuesDescribed(
"off", "Disable auto-updates",
"check", "Check for updates",
"download", "Check for updates, automatically download the update",
).Tag("auto-update modes")
}
// ActionReleaseChannels completes release channels
//
// stable (Stable, tagged releases such as \"1.0.0\")
// tip (Pre-release versions generated from each commit to the main branch)
func ActionReleaseChannels() carapace.Action {
return carapace.ActionValuesDescribed(
"stable", "Stable, tagged releases such as \"1.0.0\"",
"tip", "Pre-release versions generated from each commit to the main branch",
).Tag("release channels")
}

View File

@ -0,0 +1,52 @@
package ghostty
import "github.com/carapace-sh/carapace"
// ActionWindowNewTabPositions completes window tab positions
//
// "current (Insert the new tab after the currently focused tab)
// "end (Insert the new tab at the end of the tab list)
func ActionWindowNewTabPositions() carapace.Action {
return carapace.ActionValuesDescribed(
"current", "Insert the new tab after the currently focused tab",
"end", "Insert the new tab at the end of the tab list",
).Tag("window new tab positions")
}
// ActionWindowPaddingColors completes window padding colors
//
// background (The background color specified in `background`)
// extend (Extend the background color of the nearest grid cell)
func ActionWindowPaddingColors() carapace.Action {
return carapace.ActionValuesDescribed(
"background", "The background color specified in `background`",
"extend", "Extend the background color of the nearest grid cell",
"extend-always", "Same as \"extend\" but always extends without applying heuristics",
).Tag("window padding colors")
}
// ActionWindowSaveStates completes window save states
//
// default (will use the default system behavior)
// never (will never save window state)
func ActionWindowSaveStates() carapace.Action {
return carapace.ActionValuesDescribed(
"default", "will use the default system behavior",
"never", "will never save window state",
"always", "will always save window state",
).Tag("window save states")
}
// ActionWindowThemes completes window themes
//
// auto (Determine the theme based on the configured terminal background color)
// system (Use the system theme)
func ActionWindowThemes() carapace.Action {
return carapace.ActionValuesDescribed(
"auto", "Determine the theme based on the configured terminal background color",
"system", "Use the system theme",
"light", "Use the light theme regardless of system theme",
"dark", "Use the dark theme regardless of system theme",
"ghostty", "Use the background and foreground colors specified in the Ghostty configuration",
).Tag("window save states")
}