Skip to content

Commit

Permalink
added ghostty
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Dec 27, 2024
1 parent 9b91942 commit a1406f2
Show file tree
Hide file tree
Showing 28 changed files with 862 additions and 0 deletions.
19 changes: 19 additions & 0 deletions completers/ghostty_completer/cmd/crashReport.go
Original file line number Diff line number Diff line change
@@ -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)
}
18 changes: 18 additions & 0 deletions completers/ghostty_completer/cmd/help.go
Original file line number Diff line number Diff line change
@@ -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)
}
20 changes: 20 additions & 0 deletions completers/ghostty_completer/cmd/listActions.go
Original file line number Diff line number Diff line change
@@ -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)
}
19 changes: 19 additions & 0 deletions completers/ghostty_completer/cmd/listColors.go
Original file line number Diff line number Diff line change
@@ -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)
}
27 changes: 27 additions & 0 deletions completers/ghostty_completer/cmd/listFonts.go
Original file line number Diff line number Diff line change
@@ -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(),
})
}
20 changes: 20 additions & 0 deletions completers/ghostty_completer/cmd/listKeybinds.go
Original file line number Diff line number Diff line change
@@ -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)
}
21 changes: 21 additions & 0 deletions completers/ghostty_completer/cmd/listThemes.go
Original file line number Diff line number Diff line change
@@ -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)
}
239 changes: 239 additions & 0 deletions completers/ghostty_completer/cmd/root.go

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions completers/ghostty_completer/cmd/showConfig.go
Original file line number Diff line number Diff line change
@@ -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)
}
28 changes: 28 additions & 0 deletions completers/ghostty_completer/cmd/showFace.go
Original file line number Diff line number Diff line change
@@ -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"),
})
}
24 changes: 24 additions & 0 deletions completers/ghostty_completer/cmd/validateConfig.go
Original file line number Diff line number Diff line change
@@ -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(),
})
}
18 changes: 18 additions & 0 deletions completers/ghostty_completer/cmd/version.go
Original file line number Diff line number Diff line change
@@ -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)
}
7 changes: 7 additions & 0 deletions completers/ghostty_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/ghostty_completer/cmd"

func main() {
cmd.Execute()
}
20 changes: 20 additions & 0 deletions pkg/actions/env/ghostty.go
Original file line number Diff line number Diff line change
@@ -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(),
},
}
}
}
16 changes: 16 additions & 0 deletions pkg/actions/tools/ghostty/cursor.go
Original file line number Diff line number Diff line change
@@ -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")
}
37 changes: 37 additions & 0 deletions pkg/actions/tools/ghostty/font.go
Original file line number Diff line number Diff line change
@@ -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",
)
}
14 changes: 14 additions & 0 deletions pkg/actions/tools/ghostty/grapheme.go
Original file line number Diff line number Diff line change
@@ -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",
)
}
43 changes: 43 additions & 0 deletions pkg/actions/tools/ghostty/mac.go
Original file line number Diff line number Diff line change
@@ -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")
}

// ActionTitlebarStyles 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")
}
Loading

0 comments on commit a1406f2

Please sign in to comment.