diff --git a/completers/common/kitten_completer/cmd/ask.go b/completers/common/kitten_completer/cmd/ask.go new file mode 100644 index 0000000000..0d6622b393 --- /dev/null +++ b/completers/common/kitten_completer/cmd/ask.go @@ -0,0 +1,33 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var askCmd = &cobra.Command{ + Use: "ask", + Short: "Ask the user for input", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(askCmd).Standalone() + + askCmd.Flags().StringP("choice", "c", "", "A choice for the choices type. Can be specified multiple times. Every choice has the syntax: ``letter[;color]:text``, where text is the choice text and letter is the selection key. letter is a single letter belonging to text. This letter is highlighted within the choice text. There can be an optional color specification after the letter to indicate what color it should be. For example: y:Yes and n;red:No") + askCmd.Flags().StringP("default", "d", "", "A default choice or text. If unspecified, it is y for the type yesno, the first choice for choices and empty for others types. The default choice is selected when the user presses the Enter key.") + askCmd.Flags().BoolP("help", "h", false, "Show help for this command") + askCmd.Flags().String("hidden-text-placeholder", "", "The text in the message to be replaced by hidden text. The hidden text is read via STDIN.") + askCmd.Flags().StringP("message", "m", "", "The message to display to the user. If not specified a default message is shown.") + askCmd.Flags().StringP("name", "n", "", "The name for this question. Used to store history of previous answers which can be used for completions and via the browse history readline bindings.") + askCmd.Flags().StringP("prompt", "p", "", "The prompt to use when inputting a line of text or a password.") + askCmd.Flags().String("title", "", "The title for the window in which the question is displayed. Only implemented for yesno and choices types.") + askCmd.Flags().StringP("type", "t", "", "Type of input. Defaults to asking for a line of text.") + askCmd.Flags().String("unhide-key", "", "The key to be pressed to unhide hidden text") + askCmd.Flags().String("window-title", "", "The title for the window in which the question is displayed. Only implemented for yesno and choices types.") + rootCmd.AddCommand(askCmd) + + carapace.Gen(askCmd).FlagCompletion(carapace.ActionMap{ + "type": carapace.ActionValues("line", "choices", "file", "password", "yesno"), + }) +} diff --git a/completers/common/kitten_completer/cmd/at.go b/completers/common/kitten_completer/cmd/at.go new file mode 100644 index 0000000000..c54e106568 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at.go @@ -0,0 +1,37 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/carapace-sh/carapace-bin/pkg/actions/os" + "github.com/spf13/cobra" +) + +var atCmd = &cobra.Command{ + Use: "@", + Short: "Control kitty remotely", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(atCmd).Standalone() + + atCmd.Flags().BoolP("help", "h", false, "Show help for this command") + atCmd.Flags().String("password", "", "A password to use when contacting kitty. This will cause kitty to ask the user for permission to perform the specified action, unless the password has been accepted before or is pre-configured in kitty.conf. To use a blank password specify --use-password as always.") + atCmd.Flags().String("password-env", "", "The name of an environment variable to read the password from. Used if no --password-file is supplied. Defaults to checking the environment variable KITTY_RC_PASSWORD.") + atCmd.Flags().String("password-file", "", "A password to use when contacting kitty. This will cause kitty to ask the user for permission to perform the specified action, unless the password has been accepted before or is pre-configured in kitty.conf. To use a blank password specify --use-password as always.") + atCmd.Flags().String("to", "", "An address for the kitty instance to control. Corresponds to the address given to the kitty instance via the --listen-on option or the listen_on setting in kitty.conf. If not specified, the environment variable KITTY_LISTEN_ON is checked. If that is also not found, messages are sent to the controlling terminal for this process, i.e. they will only work if this process is run within a kitty window.") + atCmd.Flags().String("use-password", "", "If no password is available, kitty will usually just send the remote control command without a password. This option can be used to force it to always or never use the supplied password. If set to always and no password is provided, the blank password is used.") + rootCmd.AddCommand(atCmd) + + atCmd.MarkFlagsMutuallyExclusive("password-file", "password-env") + + carapace.Gen(atCmd).FlagCompletion(carapace.ActionMap{ + "password-env": os.ActionEnvironmentVariables(), + "password-file": carapace.Batch( + carapace.ActionFiles(), + carapace.ActionValuesDescribed("-", "Read from STDIN"), + carapace.ActionValuesDescribed("fd:", "Read from a file descriptor").NoSpace(':'), + ).ToA(), + "use-password": carapace.ActionValues("if-available", "always", "never"), + }) +} diff --git a/completers/common/kitten_completer/cmd/at_action.go b/completers/common/kitten_completer/cmd/at_action.go new file mode 100644 index 0000000000..4a6bae709c --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_action.go @@ -0,0 +1,27 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/carapace-sh/carapace-bin/pkg/actions/tools/kitty" + "github.com/spf13/cobra" +) + +var at_actionCmd = &cobra.Command{ + Use: "action", + Short: "Run the specified mappable action", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_actionCmd).Standalone() + + at_actionCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_actionCmd.Flags().StringP("match", "m", "", "The window to match") + at_actionCmd.Flags().Bool("no-response", false, "Don't wait for a response indicating the success of the action") + at_actionCmd.Flags().Bool("self", false, "Run the action on the window this command is run in instead of the active window") + atCmd.AddCommand(at_actionCmd) + + carapace.Gen(at_actionCmd).PositionalAnyCompletion( + kitty.ActionActions(), + ) +} diff --git a/completers/common/kitten_completer/cmd/at_closeTab.go b/completers/common/kitten_completer/cmd/at_closeTab.go new file mode 100644 index 0000000000..126394cb83 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_closeTab.go @@ -0,0 +1,24 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_closeTabCmd = &cobra.Command{ + Use: "close-tab", + Short: "Close the specified tabs", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_closeTabCmd).Standalone() + + at_closeTabCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_closeTabCmd.Flags().Bool("ignore-no-match", false, "Do not return an error if no tabs are matched to be closed") + at_closeTabCmd.Flags().StringP("match", "m", "", "The tab to match") + at_closeTabCmd.Flags().Bool("no-response", false, "Don't wait for a response indicating the success of the action") + at_closeTabCmd.Flags().Bool("self", false, "Close the tab of the window this command is run in, rather than the active tab") + atCmd.AddCommand(at_closeTabCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_closeWindow.go b/completers/common/kitten_completer/cmd/at_closeWindow.go new file mode 100644 index 0000000000..21ee30e857 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_closeWindow.go @@ -0,0 +1,24 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_closeWindowCmd = &cobra.Command{ + Use: "close-window", + Short: "Close the specified windows", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_closeWindowCmd).Standalone() + + at_closeWindowCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_closeWindowCmd.Flags().Bool("ignore-no-match", false, "Do not return an error if no windows are matched to be closed") + at_closeWindowCmd.Flags().StringP("match", "m", "", "The window to match") + at_closeWindowCmd.Flags().Bool("no-response", false, "Don't wait for a response indicating the success of the action") + at_closeWindowCmd.Flags().Bool("self", false, "Close the window this command is run in, rather than the active window") + atCmd.AddCommand(at_closeWindowCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_createMarker.go b/completers/common/kitten_completer/cmd/at_createMarker.go new file mode 100644 index 0000000000..292bc8870c --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_createMarker.go @@ -0,0 +1,22 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_createMarkerCmd = &cobra.Command{ + Use: "create-marker", + Short: "Create a marker that highlights specified text", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_createMarkerCmd).Standalone() + + at_createMarkerCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_createMarkerCmd.Flags().StringP("match", "m", "", "The window to match") + at_createMarkerCmd.Flags().Bool("self", false, "Apply marker to the window this command is run in, rather than the active window") + atCmd.AddCommand(at_createMarkerCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_detachTab.go b/completers/common/kitten_completer/cmd/at_detachTab.go new file mode 100644 index 0000000000..41cb5c1e03 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_detachTab.go @@ -0,0 +1,23 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_detachTabCmd = &cobra.Command{ + Use: "detach-tab", + Short: "Detach the specified tabs and place them in a different/new OS window", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_detachTabCmd).Standalone() + + at_detachTabCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_detachTabCmd.Flags().StringP("match", "m", "", "The tab to match") + at_detachTabCmd.Flags().Bool("self", false, "Detach the tab this command is run in, rather than the active tab") + at_detachTabCmd.Flags().StringP("target-tab", "t", "", "The tab to match") + atCmd.AddCommand(at_detachTabCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_detachWindow.go b/completers/common/kitten_completer/cmd/at_detachWindow.go new file mode 100644 index 0000000000..eed6a91bbc --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_detachWindow.go @@ -0,0 +1,24 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_detachWindowCmd = &cobra.Command{ + Use: "detach-window", + Short: "Detach the specified windows and place them in a different/new tab", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_detachWindowCmd).Standalone() + + at_detachWindowCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_detachWindowCmd.Flags().StringP("match", "m", "", "The window to match") + at_detachWindowCmd.Flags().Bool("self", false, "Detach the window this command is run in, rather than the active window") + at_detachWindowCmd.Flags().Bool("stay-in-tab", false, "Keep the focus on a window in the currently focused tab after moving the specified windows") + at_detachWindowCmd.Flags().StringP("target-tab", "t", "", "The tab to match") + atCmd.AddCommand(at_detachWindowCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_disableLigatures.go b/completers/common/kitten_completer/cmd/at_disableLigatures.go new file mode 100644 index 0000000000..721cf11b96 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_disableLigatures.go @@ -0,0 +1,23 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_disableLigaturesCmd = &cobra.Command{ + Use: "disable-ligatures", + Short: "Control ligature rendering", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_disableLigaturesCmd).Standalone() + + at_disableLigaturesCmd.Flags().BoolP("all", "a", false, "By default, ligatures are only affected in the active window") + at_disableLigaturesCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_disableLigaturesCmd.Flags().StringP("match", "m", "", "The window to match") + at_disableLigaturesCmd.Flags().StringP("match-tab", "t", "", "The tab to match") + atCmd.AddCommand(at_disableLigaturesCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_env.go b/completers/common/kitten_completer/cmd/at_env.go new file mode 100644 index 0000000000..855b5fd034 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_env.go @@ -0,0 +1,20 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_envCmd = &cobra.Command{ + Use: "env", + Short: "Change environment variables seen by future children", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_envCmd).Standalone() + + at_envCmd.Flags().BoolP("help", "h", false, "Show help for this command") + atCmd.AddCommand(at_envCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_focusTab.go b/completers/common/kitten_completer/cmd/at_focusTab.go new file mode 100644 index 0000000000..66fbc935ee --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_focusTab.go @@ -0,0 +1,22 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_focusTabCmd = &cobra.Command{ + Use: "focus-tab", + Short: "Focus the specified tab", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_focusTabCmd).Standalone() + + at_focusTabCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_focusTabCmd.Flags().StringP("match", "m", "", "The tab to match") + at_focusTabCmd.Flags().Bool("no-response", false, "Don't wait for a response indicating the success of the action") + atCmd.AddCommand(at_focusTabCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_focusWindow.go b/completers/common/kitten_completer/cmd/at_focusWindow.go new file mode 100644 index 0000000000..64e5f754f2 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_focusWindow.go @@ -0,0 +1,22 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_focusWindowCmd = &cobra.Command{ + Use: "focus-window", + Short: "Focus the specified window", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_focusWindowCmd).Standalone() + + at_focusWindowCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_focusWindowCmd.Flags().StringP("match", "m", "", "The window to match") + at_focusWindowCmd.Flags().Bool("no-response", false, "Don't wait for a response from kitty") + atCmd.AddCommand(at_focusWindowCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_getColors.go b/completers/common/kitten_completer/cmd/at_getColors.go new file mode 100644 index 0000000000..365e27ddc8 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_getColors.go @@ -0,0 +1,22 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_getColorsCmd = &cobra.Command{ + Use: "get-colors", + Short: "Get terminal colors", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_getColorsCmd).Standalone() + + at_getColorsCmd.Flags().BoolP("configured", "c", false, "Instead of outputting the colors for the specified window, output the currently configured colors") + at_getColorsCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_getColorsCmd.Flags().StringP("match", "m", "", "The window to match") + atCmd.AddCommand(at_getColorsCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_getText.go b/completers/common/kitten_completer/cmd/at_getText.go new file mode 100644 index 0000000000..811f2fb2f4 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_getText.go @@ -0,0 +1,30 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_getTextCmd = &cobra.Command{ + Use: "get-text", + Short: "Get text from the specified window", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_getTextCmd).Standalone() + + at_getTextCmd.Flags().Bool("add-cursor", false, "Add ANSI escape codes specifying the cursor position and style to the end of the text") + at_getTextCmd.Flags().Bool("add-wrap-markers", false, "Add carriage returns at every line wrap location") + at_getTextCmd.Flags().Bool("ansi", false, "Include the ANSI formatting escape codes for colors, bold, italic, etc.") + at_getTextCmd.Flags().Bool("clear-selection", false, "Clear the selection in the matched window, if any") + at_getTextCmd.Flags().String("extent", "screen", "What text to get") + at_getTextCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_getTextCmd.Flags().StringP("match", "m", "", "The window to match") + at_getTextCmd.Flags().Bool("self", false, "Get text from the window this command is run in, rather than the active window") + atCmd.AddCommand(at_getTextCmd) + + carapace.Gen(at_getTextCmd).FlagCompletion(carapace.ActionMap{ + "extent": carapace.ActionValues("screen", "all", "first_cmd_output_on_screen", "last_cmd_output", "last_non_empty_output", "last_visited_cmd_output", "selection"), + }) +} diff --git a/completers/common/kitten_completer/cmd/at_gotoLayout.go b/completers/common/kitten_completer/cmd/at_gotoLayout.go new file mode 100644 index 0000000000..0e3e98767c --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_gotoLayout.go @@ -0,0 +1,20 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_gotoLayoutCmd = &cobra.Command{ + Use: "goto-layout", + Short: "Set the window layout", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_gotoLayoutCmd).Standalone() + + at_gotoLayoutCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_gotoLayoutCmd.Flags().StringP("match", "m", "", "The tab to match") + atCmd.AddCommand(at_gotoLayoutCmd) +} diff --git a/completers/common/kitten_completer/cmd/at_kitten.go b/completers/common/kitten_completer/cmd/at_kitten.go new file mode 100644 index 0000000000..08b12d4cab --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_kitten.go @@ -0,0 +1,21 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_kittenCmd = &cobra.Command{ + Use: "kitten", + Short: "Run a kitten", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_kittenCmd).Standalone() + + at_kittenCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_kittenCmd.Flags().StringP("match", "m", "", "The window to match") + atCmd.AddCommand(at_kittenCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_lastUsedLayout.go b/completers/common/kitten_completer/cmd/at_lastUsedLayout.go new file mode 100644 index 0000000000..5d5e716ef9 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_lastUsedLayout.go @@ -0,0 +1,23 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_lastUsedLayoutCmd = &cobra.Command{ + Use: "last-used-layout", + Short: "Switch to the last used layout", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_lastUsedLayoutCmd).Standalone() + + at_lastUsedLayoutCmd.Flags().BoolP("all", "a", false, "Change the layout in all tabs") + at_lastUsedLayoutCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_lastUsedLayoutCmd.Flags().StringP("match", "m", "", "The tab to match") + at_lastUsedLayoutCmd.Flags().Bool("no-response", false, "Don't wait for a response from kitty") + atCmd.AddCommand(at_lastUsedLayoutCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_launch.go b/completers/common/kitten_completer/cmd/at_launch.go new file mode 100644 index 0000000000..b28879813b --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_launch.go @@ -0,0 +1,67 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_launchCmd = &cobra.Command{ + Use: "launch", + Short: "Run an arbitrary process in a new window/tab", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_launchCmd).Standalone() + + at_launchCmd.Flags().String("add-to-session", "", "Add the newly created window/tab to the specified session") + at_launchCmd.Flags().Bool("allow-remote-control", false, "Programs running in this window can control kitty") + at_launchCmd.Flags().String("bias", "0", "The bias used to alter the size of the window") + at_launchCmd.Flags().String("color", "", "Change colors in the newly launched window") + at_launchCmd.Flags().Bool("copy-cmdline", false, "Ignore any specified command line and instead use the command line from the source window") + at_launchCmd.Flags().Bool("copy-colors", false, "Set the colors of the newly created window to be the same as the source window") + at_launchCmd.Flags().Bool("copy-env", false, "Copy the environment variables from the source window into the newly launched child process") + at_launchCmd.Flags().String("cwd", "", "The working directory for the newly launched child") + at_launchCmd.Flags().Bool("dont-take-focus", false, "Keep the focus on the currently active window instead of switching to the newly opened window") + at_launchCmd.Flags().String("env", "", "Environment variables to set in the child process") + at_launchCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_launchCmd.Flags().Bool("hold", false, "Keep the window open even after the command being executed exits") + at_launchCmd.Flags().Bool("hold-after-ssh", false, "Run a local shell after disconnecting from the remote host") + at_launchCmd.Flags().String("location", "default", "Where to place the newly created window") + at_launchCmd.Flags().String("logo", "", "Path to a PNG image to use as the logo for the newly created window") + at_launchCmd.Flags().String("logo-alpha", "-1", "The amount the window logo should be faded into the background") + at_launchCmd.Flags().String("logo-position", "", "The position for the window logo") + at_launchCmd.Flags().String("marker", "", "Create a marker that highlights text in the newly created window") + at_launchCmd.Flags().StringP("match", "m", "", "The tab to match") + at_launchCmd.Flags().String("next-to", "", "A match expression to select the window next to which the new window is created") + at_launchCmd.Flags().Bool("no-response", false, "Do not print out the id of the newly created window") + at_launchCmd.Flags().String("os-panel", "", "Options to control the creation of desktop panels") + at_launchCmd.Flags().String("os-window-class", "", "Set the WM_CLASS property on X11 and the application id property on Wayland") + at_launchCmd.Flags().String("os-window-name", "", "Set the WM_NAME property on X11 for the newly created OS Window") + at_launchCmd.Flags().String("os-window-state", "normal", "The initial state for the newly created OS Window") + at_launchCmd.Flags().String("os-window-title", "", "Set the title for the newly created OS window") + at_launchCmd.Flags().String("remote-control-password", "", "Restrict the actions remote control is allowed to take") + at_launchCmd.Flags().String("response-timeout", "86400", "The time in seconds to wait for the started process to exit") + at_launchCmd.Flags().Bool("self", false, "Use the tab containing the window this command is run in instead of the active tab") + at_launchCmd.Flags().String("source-window", "", "A match expression to select the window from which data is copied") + at_launchCmd.Flags().String("spacing", "", "Set the margin and padding for the newly created window") + at_launchCmd.Flags().Bool("stdin-add-formatting", false, "When using --stdin-source add formatting escape codes") + at_launchCmd.Flags().Bool("stdin-add-line-wrap-markers", false, "When using --stdin-source add a carriage return at every line wrap location") + at_launchCmd.Flags().String("stdin-source", "none", "Pass the screen contents as STDIN to the child process") + at_launchCmd.Flags().String("tab-title", "", "The title for the new tab if launching in a new tab") + at_launchCmd.Flags().String("title", "", "The title to set for the new window") + at_launchCmd.Flags().String("type", "window", "Where to launch the child process") + at_launchCmd.Flags().String("var", "", "User variables to set in the created window") + at_launchCmd.Flags().Bool("wait-for-child-to-exit", false, "Wait until the launched program exits and print out its exit code") + at_launchCmd.Flags().StringP("watcher", "w", "", "Path to a Python file for event callbacks") + atCmd.AddCommand(at_launchCmd) + + carapace.Gen(at_launchCmd).FlagCompletion(carapace.ActionMap{ + "location": carapace.ActionValues("default", "after", "before", "first", "hsplit", "last", "neighbor", "split", "vsplit"), + "logo": carapace.ActionFiles(".png"), + "os-window-state": carapace.ActionValues("normal", "fullscreen", "maximized", "minimized"), + "stdin-source": carapace.ActionValues("none", "@alternate", "@alternate_scrollback", "@first_cmd_output_on_screen", "@last_cmd_output", "@last_visited_cmd_output", "@screen", "@screen_scrollback", "@selection"), + "type": carapace.ActionValues("window", "background", "clipboard", "os-panel", "os-window", "overlay", "overlay-main", "primary", "tab"), + "watcher": carapace.ActionFiles(".py"), + }) +} diff --git a/completers/common/kitten_completer/cmd/at_loadConfig.go b/completers/common/kitten_completer/cmd/at_loadConfig.go new file mode 100644 index 0000000000..51bc40e531 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_loadConfig.go @@ -0,0 +1,23 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_loadConfigCmd = &cobra.Command{ + Use: "load-config", + Short: "(Re)load a config file", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_loadConfigCmd).Standalone() + + at_loadConfigCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_loadConfigCmd.Flags().Bool("ignore-overrides", false, "Have previous config overrides ignored") + at_loadConfigCmd.Flags().Bool("no-response", false, "Don't wait for a response indicating the success of the action") + at_loadConfigCmd.Flags().StringP("override", "o", "", "Override individual configuration options") + atCmd.AddCommand(at_loadConfigCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_ls.go b/completers/common/kitten_completer/cmd/at_ls.go new file mode 100644 index 0000000000..f4965c157f --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_ls.go @@ -0,0 +1,28 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_lsCmd = &cobra.Command{ + Use: "ls", + Short: "List tabs/windows", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_lsCmd).Standalone() + + at_lsCmd.Flags().Bool("all-env-vars", false, "Show all environment variables in output, not just differing ones") + at_lsCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_lsCmd.Flags().StringP("match", "m", "", "The window to match") + at_lsCmd.Flags().StringP("match-tab", "t", "", "The tab to match") + at_lsCmd.Flags().String("output-format", "json", "Output in JSON or kitty session format") + at_lsCmd.Flags().Bool("self", false, "Only list the window this command is run in") + atCmd.AddCommand(at_lsCmd) + + carapace.Gen(at_lsCmd).FlagCompletion(carapace.ActionMap{ + "output-format": carapace.ActionValues("json", "session"), + }) +} diff --git a/completers/common/kitten_completer/cmd/at_newWindow.go b/completers/common/kitten_completer/cmd/at_newWindow.go new file mode 100644 index 0000000000..3f68e013ef --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_newWindow.go @@ -0,0 +1,31 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_newWindowCmd = &cobra.Command{ + Use: "new-window", + Short: "Open new window", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_newWindowCmd).Standalone() + + at_newWindowCmd.Flags().String("cwd", "", "The initial working directory for the new window") + at_newWindowCmd.Flags().Bool("dont-take-focus", false, "Keep the current window focused instead of switching to the newly opened window") + at_newWindowCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_newWindowCmd.Flags().StringP("match", "m", "", "The tab to match") + at_newWindowCmd.Flags().Bool("new-tab", false, "Open a new tab") + at_newWindowCmd.Flags().Bool("no-response", false, "Don't wait for a response giving the id of the newly opened window") + at_newWindowCmd.Flags().String("tab-title", "", "Set the title of the tab, when open a new tab") + at_newWindowCmd.Flags().String("title", "", "The title for the new window") + at_newWindowCmd.Flags().String("window-type", "kitty", "What kind of window to open") + atCmd.AddCommand(at_newWindowCmd) + + carapace.Gen(at_newWindowCmd).FlagCompletion(carapace.ActionMap{ + "window-type": carapace.ActionValues("kitty", "os"), + }) +} diff --git a/completers/common/kitten_completer/cmd/at_removeMarker.go b/completers/common/kitten_completer/cmd/at_removeMarker.go new file mode 100644 index 0000000000..87b8e87147 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_removeMarker.go @@ -0,0 +1,22 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_removeMarkerCmd = &cobra.Command{ + Use: "remove-marker", + Short: "Remove the currently set marker, if any.", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_removeMarkerCmd).Standalone() + + at_removeMarkerCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_removeMarkerCmd.Flags().StringP("match", "m", "", "The window to match") + at_removeMarkerCmd.Flags().Bool("self", false, "Apply marker to the window this command is run in, rather than the active window") + atCmd.AddCommand(at_removeMarkerCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_resizeOsWindow.go b/completers/common/kitten_completer/cmd/at_resizeOsWindow.go new file mode 100644 index 0000000000..e1822d59a8 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_resizeOsWindow.go @@ -0,0 +1,28 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_resizeOsWindowCmd = &cobra.Command{ + Use: "resize-os-window", + Short: "Resize/show/hide/etc. the specified OS Windows", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_resizeOsWindowCmd).Standalone() + + at_resizeOsWindowCmd.Flags().String("action", "resize", "The action to perform") + at_resizeOsWindowCmd.Flags().String("height", "0", "Change the height of the window") + at_resizeOsWindowCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_resizeOsWindowCmd.Flags().Bool("incremental", false, "Treat the specified sizes as increments on the existing window size") + at_resizeOsWindowCmd.Flags().StringP("match", "m", "", "The window to match") + at_resizeOsWindowCmd.Flags().Bool("no-response", false, "Don't wait for a response indicating the success of the action") + at_resizeOsWindowCmd.Flags().Bool("self", false, "Resize the window this command is run in, rather than the active window") + at_resizeOsWindowCmd.Flags().String("unit", "cells", "The unit in which to interpret specified sizes") + at_resizeOsWindowCmd.Flags().String("width", "0", "Change the width of the window") + atCmd.AddCommand(at_resizeOsWindowCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_resizeWindow.go b/completers/common/kitten_completer/cmd/at_resizeWindow.go new file mode 100644 index 0000000000..858770b03c --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_resizeWindow.go @@ -0,0 +1,24 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_resizeWindowCmd = &cobra.Command{ + Use: "resize-window", + Short: "Resize the specified windows", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_resizeWindowCmd).Standalone() + + at_resizeWindowCmd.Flags().StringP("axis", "a", "horizontal", "The axis along which to resize") + at_resizeWindowCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_resizeWindowCmd.Flags().StringP("increment", "i", "2", "The number of cells to change the size by") + at_resizeWindowCmd.Flags().StringP("match", "m", "", "The window to match") + at_resizeWindowCmd.Flags().Bool("self", false, "Resize the window this command is run in, rather than the active window") + atCmd.AddCommand(at_resizeWindowCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_run.go b/completers/common/kitten_completer/cmd/at_run.go new file mode 100644 index 0000000000..c0803eb3c2 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_run.go @@ -0,0 +1,23 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_runCmd = &cobra.Command{ + Use: "run", + Short: "Run a program on the computer in which kitty is running and get the output", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_runCmd).Standalone() + + at_runCmd.Flags().Bool("allow-remote-control", false, "The executed program will have privileges to run remote control commands in kitty") + at_runCmd.Flags().String("env", "", "Environment variables to set in the child process") + at_runCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_runCmd.Flags().String("remote-control-password", "", "Restrict the actions remote control is allowed to take") + atCmd.AddCommand(at_runCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_scrollWindow.go b/completers/common/kitten_completer/cmd/at_scrollWindow.go new file mode 100644 index 0000000000..12dba255af --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_scrollWindow.go @@ -0,0 +1,22 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_scrollWindowCmd = &cobra.Command{ + Use: "scroll-window", + Short: "Scroll the specified windows", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_scrollWindowCmd).Standalone() + + at_scrollWindowCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_scrollWindowCmd.Flags().StringP("match", "m", "", "The window to match") + at_scrollWindowCmd.Flags().Bool("no-response", false, "Don't wait for a response indicating the success of the action") + atCmd.AddCommand(at_scrollWindowCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_selectWindow.go b/completers/common/kitten_completer/cmd/at_selectWindow.go new file mode 100644 index 0000000000..4cc42c3268 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_selectWindow.go @@ -0,0 +1,26 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_selectWindowCmd = &cobra.Command{ + Use: "select-window", + Short: "Visually select a window in the specified tab", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_selectWindowCmd).Standalone() + + at_selectWindowCmd.Flags().Bool("exclude-active", false, "Exclude the currently active window from the list of windows to pick") + at_selectWindowCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_selectWindowCmd.Flags().StringP("match", "m", "", "The tab to match") + at_selectWindowCmd.Flags().Bool("reactivate-prev-tab", false, "When the selection is finished, the previously activated tab will be reactivated") + at_selectWindowCmd.Flags().String("response-timeout", "60", "The time in seconds to wait for the user to select a window") + at_selectWindowCmd.Flags().Bool("self", false, "Select window from the tab containing the window this command is run in") + at_selectWindowCmd.Flags().String("title", "", "A title that will be displayed to the user to describe what this selection is for") + atCmd.AddCommand(at_selectWindowCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_sendKey.go b/completers/common/kitten_completer/cmd/at_sendKey.go new file mode 100644 index 0000000000..c2c6c48644 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_sendKey.go @@ -0,0 +1,24 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_sendKeyCmd = &cobra.Command{ + Use: "send-key", + Short: "Send arbitrary key presses to the specified windows", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_sendKeyCmd).Standalone() + + at_sendKeyCmd.Flags().Bool("all", false, "Match all windows") + at_sendKeyCmd.Flags().Bool("exclude-active", false, "Do not send text to the active window, even if it is one of the matched windows") + at_sendKeyCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_sendKeyCmd.Flags().StringP("match", "m", "", "The window to match") + at_sendKeyCmd.Flags().StringP("match-tab", "t", "", "The tab to match") + atCmd.AddCommand(at_sendKeyCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_sendText.go b/completers/common/kitten_completer/cmd/at_sendText.go new file mode 100644 index 0000000000..04a4e6b18c --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_sendText.go @@ -0,0 +1,27 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_sendTextCmd = &cobra.Command{ + Use: "send-text", + Short: "Send arbitrary text to specified windows", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_sendTextCmd).Standalone() + + at_sendTextCmd.Flags().Bool("all", false, "Match all windows") + at_sendTextCmd.Flags().String("bracketed-paste", "disable", "When sending text to a window, wrap the text in bracketed paste escape codes") + at_sendTextCmd.Flags().Bool("exclude-active", false, "Do not send text to the active window, even if it is one of the matched windows") + at_sendTextCmd.Flags().String("from-file", "", "Path to a file whose contents you wish to send") + at_sendTextCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_sendTextCmd.Flags().StringP("match", "m", "", "The window to match") + at_sendTextCmd.Flags().StringP("match-tab", "t", "", "The tab to match") + at_sendTextCmd.Flags().Bool("stdin", false, "Read the text to be sent from stdin") + atCmd.AddCommand(at_sendTextCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_setBackgroundImage.go b/completers/common/kitten_completer/cmd/at_setBackgroundImage.go new file mode 100644 index 0000000000..f480db060d --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_setBackgroundImage.go @@ -0,0 +1,25 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_setBackgroundImageCmd = &cobra.Command{ + Use: "set-background-image", + Short: "Set the background image", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_setBackgroundImageCmd).Standalone() + + at_setBackgroundImageCmd.Flags().BoolP("all", "a", false, "By default, background image is only changed for the currently active OS window") + at_setBackgroundImageCmd.Flags().BoolP("configured", "c", false, "Change the configured background image which is used for new OS windows") + at_setBackgroundImageCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_setBackgroundImageCmd.Flags().String("layout", "configured", "How the image should be displayed") + at_setBackgroundImageCmd.Flags().StringP("match", "m", "", "The window to match") + at_setBackgroundImageCmd.Flags().Bool("no-response", false, "Don't wait for a response from kitty") + atCmd.AddCommand(at_setBackgroundImageCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_setBackgroundOpacity.go b/completers/common/kitten_completer/cmd/at_setBackgroundOpacity.go new file mode 100644 index 0000000000..a4b498ce07 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_setBackgroundOpacity.go @@ -0,0 +1,24 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_setBackgroundOpacityCmd = &cobra.Command{ + Use: "set-background-opacity", + Short: "Set the background opacity", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_setBackgroundOpacityCmd).Standalone() + + at_setBackgroundOpacityCmd.Flags().BoolP("all", "a", false, "By default, background opacity are only changed for the currently active OS window") + at_setBackgroundOpacityCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_setBackgroundOpacityCmd.Flags().StringP("match", "m", "", "The window to match") + at_setBackgroundOpacityCmd.Flags().StringP("match-tab", "t", "", "The tab to match") + at_setBackgroundOpacityCmd.Flags().Bool("toggle", false, "When specified, the background opacity for the matching OS windows will be reset to default if it is currently equal to the specified value") + atCmd.AddCommand(at_setBackgroundOpacityCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_setColors.go b/completers/common/kitten_completer/cmd/at_setColors.go new file mode 100644 index 0000000000..908bec89a1 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_setColors.go @@ -0,0 +1,25 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_setColorsCmd = &cobra.Command{ + Use: "set-colors", + Short: "Set terminal colors", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_setColorsCmd).Standalone() + + at_setColorsCmd.Flags().BoolP("all", "a", false, "By default, colors are only changed for the currently active window") + at_setColorsCmd.Flags().BoolP("configured", "c", false, "Also change the configured colors") + at_setColorsCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_setColorsCmd.Flags().StringP("match", "m", "", "The window to match") + at_setColorsCmd.Flags().StringP("match-tab", "t", "", "The tab to match") + at_setColorsCmd.Flags().Bool("reset", false, "Restore all colors to the values they had at kitty startup") + atCmd.AddCommand(at_setColorsCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_setEnabledLayouts.go b/completers/common/kitten_completer/cmd/at_setEnabledLayouts.go new file mode 100644 index 0000000000..07a6868d85 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_setEnabledLayouts.go @@ -0,0 +1,22 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_setEnabledLayoutsCmd = &cobra.Command{ + Use: "set-enabled-layouts", + Short: "Set the enabled layouts in tabs", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_setEnabledLayoutsCmd).Standalone() + + at_setEnabledLayoutsCmd.Flags().Bool("configured", false, "Change the default enabled layout value so that the new value takes effect for all newly created tabs as well") + at_setEnabledLayoutsCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_setEnabledLayoutsCmd.Flags().StringP("match", "m", "", "The tab to match") + atCmd.AddCommand(at_setEnabledLayoutsCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_setFontSize.go b/completers/common/kitten_completer/cmd/at_setFontSize.go new file mode 100644 index 0000000000..7c50581bfa --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_setFontSize.go @@ -0,0 +1,21 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_setFontSizeCmd = &cobra.Command{ + Use: "set-font-size", + Short: "Set the font size in the active top-level OS window", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_setFontSizeCmd).Standalone() + + at_setFontSizeCmd.Flags().BoolP("all", "a", false, "By default, the font size is only changed in the active OS window, this option will cause it to be changed in all OS windows") + at_setFontSizeCmd.Flags().BoolP("help", "h", false, "Show help for this command") + atCmd.AddCommand(at_setFontSizeCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_setSpacing.go b/completers/common/kitten_completer/cmd/at_setSpacing.go new file mode 100644 index 0000000000..0bba94854f --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_setSpacing.go @@ -0,0 +1,24 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_setSpacingCmd = &cobra.Command{ + Use: "set-spacing", + Short: "Set window paddings and margins", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_setSpacingCmd).Standalone() + + at_setSpacingCmd.Flags().BoolP("all", "a", false, "By default, settings are only changed for the currently active window") + at_setSpacingCmd.Flags().BoolP("configured", "c", false, "Also change the configured paddings and margins") + at_setSpacingCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_setSpacingCmd.Flags().StringP("match", "m", "", "The window to match") + at_setSpacingCmd.Flags().StringP("match-tab", "t", "", "The tab to match") + atCmd.AddCommand(at_setSpacingCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_setTabColor.go b/completers/common/kitten_completer/cmd/at_setTabColor.go new file mode 100644 index 0000000000..37ce306fe2 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_setTabColor.go @@ -0,0 +1,22 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_setTabColorCmd = &cobra.Command{ + Use: "set-tab-color", + Short: "Change the color of the specified tabs in the tab bar", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_setTabColorCmd).Standalone() + + at_setTabColorCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_setTabColorCmd.Flags().StringP("match", "m", "", "The tab to match") + at_setTabColorCmd.Flags().Bool("self", false, "Close the tab this command is run in, rather than the active tab") + atCmd.AddCommand(at_setTabColorCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_setTabTitle.go b/completers/common/kitten_completer/cmd/at_setTabTitle.go new file mode 100644 index 0000000000..8ccd221d46 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_setTabTitle.go @@ -0,0 +1,21 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_setTabTitleCmd = &cobra.Command{ + Use: "set-tab-title", + Short: "Set the tab title", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_setTabTitleCmd).Standalone() + + at_setTabTitleCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_setTabTitleCmd.Flags().StringP("match", "m", "", "The tab to match") + atCmd.AddCommand(at_setTabTitleCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_setUserVars.go b/completers/common/kitten_completer/cmd/at_setUserVars.go new file mode 100644 index 0000000000..0d00bf3da7 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_setUserVars.go @@ -0,0 +1,21 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_setUserVarsCmd = &cobra.Command{ + Use: "set-user-vars", + Short: "Set user variables on a window", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_setUserVarsCmd).Standalone() + + at_setUserVarsCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_setUserVarsCmd.Flags().StringP("match", "m", "", "The window to match") + atCmd.AddCommand(at_setUserVarsCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_setWindowLogo.go b/completers/common/kitten_completer/cmd/at_setWindowLogo.go new file mode 100644 index 0000000000..415d75833c --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_setWindowLogo.go @@ -0,0 +1,25 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_setWindowLogoCmd = &cobra.Command{ + Use: "set-window-logo", + Short: "Set the window logo", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_setWindowLogoCmd).Standalone() + + at_setWindowLogoCmd.Flags().String("alpha", "-1", "The amount the window logo should be faded into the background") + at_setWindowLogoCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_setWindowLogoCmd.Flags().StringP("match", "m", "", "The window to match") + at_setWindowLogoCmd.Flags().Bool("no-response", false, "Don't wait for a response from kitty") + at_setWindowLogoCmd.Flags().String("position", "", "The position for the window logo") + at_setWindowLogoCmd.Flags().Bool("self", false, "Act on the window this command is run in, rather than the active window") + atCmd.AddCommand(at_setWindowLogoCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_setWindowTitle.go b/completers/common/kitten_completer/cmd/at_setWindowTitle.go new file mode 100644 index 0000000000..10625d7362 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_setWindowTitle.go @@ -0,0 +1,22 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_setWindowTitleCmd = &cobra.Command{ + Use: "set-window-title", + Short: "Set the window title", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_setWindowTitleCmd).Standalone() + + at_setWindowTitleCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_setWindowTitleCmd.Flags().StringP("match", "m", "", "The window to match") + at_setWindowTitleCmd.Flags().Bool("temporary", false, "By default, the title will be permanently changed and programs running in the window will not be able to change it again") + atCmd.AddCommand(at_setWindowTitleCmd) + +} diff --git a/completers/common/kitten_completer/cmd/at_signalChild.go b/completers/common/kitten_completer/cmd/at_signalChild.go new file mode 100644 index 0000000000..f85f2c9ab5 --- /dev/null +++ b/completers/common/kitten_completer/cmd/at_signalChild.go @@ -0,0 +1,22 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var at_signalChildCmd = &cobra.Command{ + Use: "signal-child", + Short: "Send a signal to the foreground process in the specified windows", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(at_signalChildCmd).Standalone() + + at_signalChildCmd.Flags().BoolP("help", "h", false, "Show help for this command") + at_signalChildCmd.Flags().StringP("match", "m", "", "The window to match") + at_signalChildCmd.Flags().Bool("no-response", false, "Don't wait for a response indicating the success of the action") + atCmd.AddCommand(at_signalChildCmd) + +} diff --git a/completers/common/kitten_completer/cmd/chooseFiles.go b/completers/common/kitten_completer/cmd/chooseFiles.go new file mode 100644 index 0000000000..4c70cb773a --- /dev/null +++ b/completers/common/kitten_completer/cmd/chooseFiles.go @@ -0,0 +1,42 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var chooseFilesCmd = &cobra.Command{ + Use: "choose-files", + Short: "Choose files, fast", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(chooseFilesCmd).Standalone() + + chooseFilesCmd.Flags().Bool("clear-cache", false, "Clear the caches used by this kitten.") + chooseFilesCmd.Flags().String("config", "", "Specify a path to the configuration file(s) to use. All configuration files are merged onto the builtin choose-files.conf, overriding the builtin values. This option can be specified multiple times to read multiple configuration files in sequence, which are merged. Use the special value NONE to not load any config file.") + chooseFilesCmd.Flags().Bool("display-title", false, "Show the window title at the top, useful when this kitten is used in an OS window without a title bar.") + chooseFilesCmd.Flags().StringArray("file-filter", nil, "A list of filters to restrict the displayed files. Can be either mimetypes, or glob style patterns. Can be specified multiple times. The syntax is type:expression:Descriptive Name. For example: mime:image/png:Images and mime:image/gif:Images and glob:*.[tT][xX][Tt]:Text files.") + chooseFilesCmd.Flags().BoolP("help", "h", false, "Show help for this command") + chooseFilesCmd.Flags().String("mode", "", "The type of object(s) to select") + chooseFilesCmd.Flags().String("output-format", "", "The format in which to write the output. The text format is absolute paths separated by newlines. The shell format is quoted absolute paths separated by spaces, quoting is done only if needed. The shell-relative format is the same as shell except it returns paths relative to the starting directory.") + chooseFilesCmd.Flags().StringArrayP("override", "o", nil, "Override individual configuration options, can be specified multiple times. Syntax: name=value.") + chooseFilesCmd.Flags().String("suggested-save-file-name", "", "A suggested name when picking a save file.") + chooseFilesCmd.Flags().String("suggested-save-file-path", "", "Path to an existing file to use as the save file.") + chooseFilesCmd.Flags().String("title", "", "Window title to use for this chooser") + chooseFilesCmd.Flags().String("write-output-to", "", "Path to a file to which the output is written in addition to STDOUT.") + chooseFilesCmd.Flags().String("write-pid-to", "", "Path to a file to which to write the process ID (PID) of this process to.") + rootCmd.AddCommand(chooseFilesCmd) + + carapace.Gen(chooseFilesCmd).FlagCompletion(carapace.ActionMap{ + "config": carapace.ActionFiles("~/.config/kitty"), + "mode": carapace.ActionValues("file", "dir", "dirs", "files", "save-dir", "save-file", "save-files"), + "output-format": carapace.ActionValues("text", "json", "shell", "shell-relative"), + "suggested-save-file-path": carapace.ActionFiles(), + "write-output-to": carapace.ActionFiles(), + "write-pid-to": carapace.ActionFiles(), + }) + + carapace.Gen(chooseFilesCmd).PositionalAnyCompletion(carapace.ActionDirectories()) +} diff --git a/completers/common/kitten_completer/cmd/chooseFonts.go b/completers/common/kitten_completer/cmd/chooseFonts.go new file mode 100644 index 0000000000..e16e7f4f1e --- /dev/null +++ b/completers/common/kitten_completer/cmd/chooseFonts.go @@ -0,0 +1,28 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var chooseFontsCmd = &cobra.Command{ + Use: "choose-fonts", + Short: "Choose the fonts used in kitty", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(chooseFontsCmd).Standalone() + + chooseFontsCmd.Flags().String("config-file-name", "", "The name or path to the config file to edit. Relative paths are interpreted with respect to the kitty config directory. By default the kitty config file, kitty.conf is edited. This is most useful if you add include themes.conf to your kitty.conf and then have the kitten operate only on themes.conf, allowing kitty.conf to remain unchanged.") + chooseFontsCmd.Flags().BoolP("help", "h", false, "Show help for this command") + chooseFontsCmd.Flags().String("reload-in", "", "By default, this kitten will signal only the parent kitty instance it is running in to reload its config, after making changes. Use this option to instead either not reload the config at all or in all running kitty instances.") + rootCmd.AddCommand(chooseFontsCmd) + + carapace.Gen(chooseFontsCmd).FlagCompletion(carapace.ActionMap{ + "config-file-name": carapace.ActionFiles("~/.config/kitty"), + "reload-in": carapace.ActionValues("parent", "all", "none"), + }) + + carapace.Gen(chooseFontsCmd).PositionalAnyCompletion(carapace.ActionFiles()) +} diff --git a/completers/common/kitten_completer/cmd/clipboard.go b/completers/common/kitten_completer/cmd/clipboard.go new file mode 100644 index 0000000000..6008b605be --- /dev/null +++ b/completers/common/kitten_completer/cmd/clipboard.go @@ -0,0 +1,40 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var clipboardCmd = &cobra.Command{ + Use: "clipboard", + Short: "Copy/paste with the system clipboard, even over SSH", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(clipboardCmd).Standalone() + + clipboardCmd.Flags().StringArrayP("alias", "a", nil, "Specify aliases for MIME types. Aliased MIME types are considered equivalent. When copying to clipboard both the original and alias are made available on the clipboard. When copying from clipboard if the original is not found, the alias is used, as a fallback. Can be specified multiple times to create multiple aliases. For example: --alias text/plain=text/x-rst makes text/plain an alias of text/rst. Aliases are not used in filter mode. An alias for text/plain is automatically created if text/plain is not present in the input data, but some other text/* MIME is present.") + clipboardCmd.Flags().BoolP("get-clipboard", "g", false, "Output the current contents of the clipboard to STDOUT. Note that by default kitty will prompt for permission to access the clipboard. Can be controlled by clipboard_control.") + clipboardCmd.Flags().BoolP("help", "h", false, "Show help for this command") + clipboardCmd.Flags().String("human-name", "", "A human friendly name to show the user when asking for permission to access the clipboard.") + clipboardCmd.Flags().StringArrayP("mime", "m", nil, "The mimetype of the specified file. Useful when the auto-detected mimetype is likely to be incorrect or the filename has no extension and therefore no mimetype can be detected. If more than one file is specified, this option should be specified multiple times, once for each specified file. When copying data from the clipboard, you can use wildcards to match MIME types. For example: --mime 'text/*' will match any textual MIME type available on the clipboard, usually the first matching MIME type is copied. The special MIME type . will return the list of available MIME types currently on the system clipboard.") + clipboardCmd.Flags().String("password", "", "A password to use when accessing the clipboard. If the user chooses to accept the password future invocations of the kitten will not have a permission prompt in this tty session. Does not work in filter mode. Must be of the form: text:actual-password or fd:integer (a file descriptor number to read the password from) or file:path-to-file (a file from which to read the password). Note that you must also specify a human friendly name using the --human-name flag.") + clipboardCmd.Flags().BoolP("use-primary", "p", false, "Use the primary selection rather than the clipboard on systems that support it, such as Linux.") + clipboardCmd.Flags().Bool("wait-for-completion", false, "Wait till the copy to clipboard is complete before exiting. Useful if running the kitten in a dedicated, ephemeral window. Only needed in filter mode.") + rootCmd.AddCommand(clipboardCmd) + + carapace.Gen(clipboardCmd).FlagCompletion(carapace.ActionMap{ + "password": carapace.ActionValues("text:", "fd:", "file:").MultiPartsP(":", "<.*>", func(placeholder string, matches map[string]string) carapace.Action { + switch placeholder { + case "": + return carapace.ActionFiles() + default: + return carapace.ActionValues() + } + }), + }) + carapace.Gen(clipboardCmd).PositionalAnyCompletion( + carapace.ActionFiles(), + ) +} diff --git a/completers/common/kitten_completer/cmd/desktopUi.go b/completers/common/kitten_completer/cmd/desktopUi.go new file mode 100644 index 0000000000..1e82676fc7 --- /dev/null +++ b/completers/common/kitten_completer/cmd/desktopUi.go @@ -0,0 +1,19 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var desktopUiCmd = &cobra.Command{ + Use: "desktop-ui", + Short: "Implement various desktop components for use with lightweight compositors/window managers on Linux", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(desktopUiCmd).Standalone() + + desktopUiCmd.Flags().BoolP("help", "h", false, "Show help for this command") + rootCmd.AddCommand(desktopUiCmd) +} diff --git a/completers/common/kitten_completer/cmd/desktopUi_enablePortal.go b/completers/common/kitten_completer/cmd/desktopUi_enablePortal.go new file mode 100644 index 0000000000..9c99c2e1cf --- /dev/null +++ b/completers/common/kitten_completer/cmd/desktopUi_enablePortal.go @@ -0,0 +1,20 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var desktopUi_enablePortalCmd = &cobra.Command{ + Use: "enable-portal", + Short: "Create or edit files needed so that the portal from this kitten is used by xdg-desktop-portal", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(desktopUi_enablePortalCmd).Standalone() + + desktopUi_enablePortalCmd.Flags().BoolP("help", "h", false, "Show help for this command") + desktopUiCmd.AddCommand(desktopUi_enablePortalCmd) + +} diff --git a/completers/common/kitten_completer/cmd/desktopUi_runServer.go b/completers/common/kitten_completer/cmd/desktopUi_runServer.go new file mode 100644 index 0000000000..7a69fd8fb8 --- /dev/null +++ b/completers/common/kitten_completer/cmd/desktopUi_runServer.go @@ -0,0 +1,25 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var desktopUi_runServerCmd = &cobra.Command{ + Use: "run-server", + Short: "Start the various servers used to integrate with the Linux desktop", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(desktopUi_runServerCmd).Standalone() + + desktopUi_runServerCmd.Flags().StringP("config", "c", "", "Specify a path to the configuration file(s) to use") + desktopUi_runServerCmd.Flags().BoolP("help", "h", false, "Show help for this command") + desktopUi_runServerCmd.Flags().StringP("override", "o", "", "Override individual configuration options, can be specified multiple times") + desktopUiCmd.AddCommand(desktopUi_runServerCmd) + + carapace.Gen(desktopUi_runServerCmd).FlagCompletion(carapace.ActionMap{ + "config": carapace.ActionFiles(), + }) +} diff --git a/completers/common/kitten_completer/cmd/desktopUi_setAccentColor.go b/completers/common/kitten_completer/cmd/desktopUi_setAccentColor.go new file mode 100644 index 0000000000..aebaadcb95 --- /dev/null +++ b/completers/common/kitten_completer/cmd/desktopUi_setAccentColor.go @@ -0,0 +1,20 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var desktopUi_setAccentColorCmd = &cobra.Command{ + Use: "set-accent-color", + Short: "Change the accent color", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(desktopUi_setAccentColorCmd).Standalone() + + desktopUi_setAccentColorCmd.Flags().BoolP("help", "h", false, "Show help for this command") + desktopUiCmd.AddCommand(desktopUi_setAccentColorCmd) + +} diff --git a/completers/common/kitten_completer/cmd/desktopUi_setColorScheme.go b/completers/common/kitten_completer/cmd/desktopUi_setColorScheme.go new file mode 100644 index 0000000000..bcc340f9d6 --- /dev/null +++ b/completers/common/kitten_completer/cmd/desktopUi_setColorScheme.go @@ -0,0 +1,23 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var desktopUi_setColorSchemeCmd = &cobra.Command{ + Use: "set-color-scheme", + Short: "Change the color scheme", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(desktopUi_setColorSchemeCmd).Standalone() + + desktopUi_setColorSchemeCmd.Flags().BoolP("help", "h", false, "Show help for this command") + desktopUiCmd.AddCommand(desktopUi_setColorSchemeCmd) + + carapace.Gen(desktopUi_setColorSchemeCmd).PositionalCompletion( + carapace.ActionValues("light", "dark", "no-preference", "toggle"), + ) +} diff --git a/completers/common/kitten_completer/cmd/desktopUi_setContrast.go b/completers/common/kitten_completer/cmd/desktopUi_setContrast.go new file mode 100644 index 0000000000..8ddd6d802a --- /dev/null +++ b/completers/common/kitten_completer/cmd/desktopUi_setContrast.go @@ -0,0 +1,23 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var desktopUi_setContrastCmd = &cobra.Command{ + Use: "set-contrast", + Short: "Change the contrast", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(desktopUi_setContrastCmd).Standalone() + + desktopUi_setContrastCmd.Flags().BoolP("help", "h", false, "Show help for this command") + desktopUiCmd.AddCommand(desktopUi_setContrastCmd) + + carapace.Gen(desktopUi_setContrastCmd).PositionalCompletion( + carapace.ActionValues("high", "normal"), + ) +} diff --git a/completers/common/kitten_completer/cmd/desktopUi_setSetting.go b/completers/common/kitten_completer/cmd/desktopUi_setSetting.go new file mode 100644 index 0000000000..64625aa5ac --- /dev/null +++ b/completers/common/kitten_completer/cmd/desktopUi_setSetting.go @@ -0,0 +1,22 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var desktopUi_setSettingCmd = &cobra.Command{ + Use: "set-setting", + Short: "Change an arbitrary setting", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(desktopUi_setSettingCmd).Standalone() + + desktopUi_setSettingCmd.Flags().String("data-type", "", "The DBUS data type signature of the value") + desktopUi_setSettingCmd.Flags().BoolP("help", "h", false, "Show help for this command") + desktopUi_setSettingCmd.Flags().StringP("namespace", "n", "org.freedesktop.appearance", "The namespace in which to change the setting") + desktopUiCmd.AddCommand(desktopUi_setSettingCmd) + +} diff --git a/completers/common/kitten_completer/cmd/desktopUi_showSettings.go b/completers/common/kitten_completer/cmd/desktopUi_showSettings.go new file mode 100644 index 0000000000..c6babb27a9 --- /dev/null +++ b/completers/common/kitten_completer/cmd/desktopUi_showSettings.go @@ -0,0 +1,23 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var desktopUi_showSettingsCmd = &cobra.Command{ + Use: "show-settings", + Short: "Print the current values of the desktop settings", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(desktopUi_showSettingsCmd).Standalone() + + desktopUi_showSettingsCmd.Flags().Bool("allow-other-backends", false, "Normally, after printing the settings, if the settings did not come from the desktop-ui kitten the command prints an error and exits. This prevents that.") + desktopUi_showSettingsCmd.Flags().Bool("as-json", false, "Show the settings as JSON for machine consumption") + desktopUi_showSettingsCmd.Flags().BoolP("help", "h", false, "Show help for this command") + desktopUi_showSettingsCmd.Flags().String("in-namespace", "", "Show only settings in the specified namespaces") + desktopUiCmd.AddCommand(desktopUi_showSettingsCmd) + +} diff --git a/completers/common/kitten_completer/cmd/diff.go b/completers/common/kitten_completer/cmd/diff.go new file mode 100644 index 0000000000..d3d467906f --- /dev/null +++ b/completers/common/kitten_completer/cmd/diff.go @@ -0,0 +1,31 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var diffCmd = &cobra.Command{ + Use: "diff", + Short: "Pretty, side-by-side diffing of files and images", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(diffCmd).Standalone() + + diffCmd.Flags().StringArray("config", nil, "Specify a path to the configuration file(s) to use. All configuration files are merged onto the builtin diff.conf, overriding the builtin values. This option can be specified multiple times to read multiple configuration files in sequence, which are merged. Use the special value NONE to not load any config file.") + diffCmd.Flags().Int("context", 0, "Number of lines of context to show between changes. Negative values use the number set in diff.conf.") + diffCmd.Flags().BoolP("help", "h", false, "Show help for this command") + diffCmd.Flags().StringP("override", "o", "", "Override individual configuration options, can be specified multiple times. Syntax: name=value. For example: -o background=gray") + rootCmd.AddCommand(diffCmd) + + carapace.Gen(diffCmd).FlagCompletion(carapace.ActionMap{ + "config": carapace.Batch(carapace.ActionFiles(), carapace.ActionValues("NONE", "-", "/dev/stdin")).ToA(), + }) + + carapace.Gen(diffCmd).PositionalAnyCompletion(carapace.Batch( + carapace.ActionFiles(), + carapace.ActionDirectories(), + ).ToA()) +} diff --git a/completers/common/kitten_completer/cmd/editInKitty.go b/completers/common/kitten_completer/cmd/editInKitty.go new file mode 100644 index 0000000000..d9ab2bcd75 --- /dev/null +++ b/completers/common/kitten_completer/cmd/editInKitty.go @@ -0,0 +1,66 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var editInKittyCmd = &cobra.Command{ + Use: "edit-in-kitty", + Short: "Edit a file in a kitty overlay window", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(editInKittyCmd).Standalone() + + editInKittyCmd.Flags().String("color", "", "Change colors in the newly launched window. You can either specify a path to a .conf file with the same syntax as kitty.conf to read the colors from, or specify them individually, for example:: --color background=white --color foreground=red") + editInKittyCmd.Flags().String("cwd", "", "The working directory for the newly launched child. Use the special value current to use the working directory of the --source-window. The special value last_reported uses the last working directory reported by the shell (needs shell_integration to work). The special value oldest works like current but uses the working directory of the oldest foreground process associated with the currently active window rather than the newest foreground process. Finally, the special value root refers to the process that was originally started when the window was created. When opening in the same working directory as the current window causes the new window to connect to a remote host, you can use the --hold-after-ssh flag to prevent the new window from closing when the connection is terminated.") + editInKittyCmd.Flags().Bool("dont-take-focus", false, "Keep the focus on the currently active window instead of switching to the newly opened window.") + editInKittyCmd.Flags().StringArray("env", nil, "Environment variables to set in the child process. Can be specified multiple times to set different environment variables. Syntax: name=value. Using name= will set to empty string and just name will remove the environment variable.") + editInKittyCmd.Flags().BoolP("help", "h", false, "Show help for this command") + editInKittyCmd.Flags().Bool("hold", false, "Keep the window open even after the command being executed exits, at a shell prompt. The shell will be run after the launched command exits.") + editInKittyCmd.Flags().Bool("hold-after-ssh", false, "When using --cwd=current or similar from a window that is running the ssh kitten, the new window will run a local shell after disconnecting from the remote host, when this option is specified.") + editInKittyCmd.Flags().Bool("keep-focus", false, "Keep the focus on the currently active window instead of switching to the newly opened window.") + editInKittyCmd.Flags().String("location", "", "Where to place the newly created window when it is added to a tab which already has existing windows in it. after and before place the new window before or after the active window. neighbor is a synonym for after. Also applies to creating a new tab, where the value of after will cause the new tab to be placed next to the current tab instead of at the end. The values of vsplit, hsplit and split are only used by the splits layout and control if the new window is placed in a vertical, horizontal or automatic split with the currently active window. The default is to place the window in a layout dependent manner, typically, after the currently active window. See --next-to to use a window other than the currently active window.") + editInKittyCmd.Flags().String("logo", "", "Path to a PNG image to use as the logo for the newly created window. See window_logo_path. Relative paths are resolved from the kitty configuration directory.") + editInKittyCmd.Flags().Float64("logo-alpha", 0, "The amount the window logo should be faded into the background. Only takes effect if --logo is specified. See window_logo_alpha.") + editInKittyCmd.Flags().String("logo-position", "", "The position for the window logo. Only takes effect if --logo is specified. See window_logo_position.") + editInKittyCmd.Flags().Float64("max-file-size", 0, "The maximum allowed size (in MB) of files to edit. Since the file data has to be base64 encoded and transmitted over the tty device, overly large files will not perform well.") + editInKittyCmd.Flags().String("next-to", "", "A match expression to select the window next to which the new window is created. See search_syntax for the syntax for specifying windows. If not specified defaults to the active window. When used via remote control and a target tab is specified this option is ignored unless the matched window is in the specified tab. When using --type of tab, the tab will be created in the OS Window containing the matched window.") + editInKittyCmd.Flags().String("os-window-class", "", "Set the WM_CLASS property on X11 and the application id property on Wayland for the newly created OS window when using --type. Defaults to whatever is used by the parent kitty process, which in turn defaults to kitty.") + editInKittyCmd.Flags().String("os-window-name", "", "Set the WM_NAME property on X11 for the newly created OS Window when using --type. Defaults to --os-window-class.") + editInKittyCmd.Flags().String("os-window-state", "", "The initial state for the newly created OS Window.") + editInKittyCmd.Flags().String("os-window-title", "", "Set the title for the newly created OS window. This title will override any titles set by programs running in kitty. The special value current will copy the title from the OS Window containing the --source-window.") + editInKittyCmd.Flags().String("spacing", "", "Set the margin and padding for the newly created window. For example: margin=20 or padding-left=10 or margin-h=30. The shorthand form sets all values, the *-h and *-v variants set horizontal and vertical values. Can be specified multiple times. Note that this is ignored for overlay windows as these use the settings from the base window.") + editInKittyCmd.Flags().String("tab-title", "", "The title for the new tab if launching in a new tab. By default, the title of the active window in the tab is used as the tab title. The special value current will copy the title from the tab containing the --source-window.") + editInKittyCmd.Flags().String("title", "", "The title to set for the new window. By default, title is controlled by the child process. The special value current will copy the title from the --source-window.") + editInKittyCmd.Flags().String("type", "", "Where to launch the child process:") + editInKittyCmd.Flags().StringArray("var", nil, "User variables to set in the created window. Can be specified multiple times to set different user variables. Syntax: name=value. Using name= will set to empty string.") + editInKittyCmd.Flags().String("window-title", "", "The title to set for the new window. By default, title is controlled by the child process. The special value current will copy the title from the --source-window.") + rootCmd.AddCommand(editInKittyCmd) + + carapace.Gen(editInKittyCmd).FlagCompletion(carapace.ActionMap{ + "color": carapace.ActionFiles("conf"), + "cwd": carapace.ActionValues("current", "last-reported", "oldest", "root"), + "location": carapace.ActionValues("default", "after", "before", "first", "hsplit", "last", "neighbor", "split", "vsplit"), + "logo": carapace.ActionFiles("png").Chdir("~/.config/kitty"), + "os-window-state": carapace.ActionValues("normal", "fullscreen", "maximized", "minimized"), + "tab-title": carapace.ActionValues("current"), + "title": carapace.ActionValues("current"), + "type": carapace.ActionValuesDescribed( + "window", "A new kitty window in the current tab", + "tab", "A new tab in the current OS window. Not available when the The launch command command is used in startup sessions.", + "os-window", "A new operating system window. Not available when the The launch command command is used in startup sessions.", + "overlay", "An overlay window covering the current active kitty window", + "overlay-main", "An overlay window covering the current active kitty window. Unlike a plain overlay window, this window is considered as a main window which means it is used as the active window for getting the current working directory, the input text for kittens, launch commands, etc. Useful if this overlay is intended to run for a long time as a primary window.", + "background", "The process will be run in the background, without a kitty window. Note that if --allow-remote-control is specified the KITTY_LISTEN_ON environment variable will be set to a dedicated socket pair file descriptor that the process can use for remote control.", + "clipboard", "These two are meant to work with --stdin-source to copy data to the system clipboard or primary selection.", + "primary", "These two are meant to work with --stdin-source to copy data to the system clipboard or primary selection.", + "os-panel", "Similar to os-window, except that it creates the new OS Window as a desktop panel. Only works on platforms that support this, such as Wayand compositors that support the layer shell protocol. Use the --os-panel option to configure the panel.", + ), + "window-title": carapace.ActionValues("current"), + }) + + carapace.Gen(editInKittyCmd).PositionalCompletion(carapace.ActionFiles()) +} diff --git a/completers/common/kitten_completer/cmd/hints.go b/completers/common/kitten_completer/cmd/hints.go new file mode 100644 index 0000000000..80cad158bf --- /dev/null +++ b/completers/common/kitten_completer/cmd/hints.go @@ -0,0 +1,53 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var hintsCmd = &cobra.Command{ + Use: "hints", + Short: "Select text from the screen using the keyboard", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(hintsCmd).Standalone() + + hintsCmd.Flags().String("add-trailing-space", "", "Add trailing space after matched text. Defaults to auto, which adds the space when used together with --multiple.") + hintsCmd.Flags().String("alphabet", "", "The list of characters to use for hints. The default is to use numbers and lowercase English alphabets. Specify your preference as a string of characters. Note that you need to specify the --hints-offset as zero to use the first character to highlight the first match, otherwise it will start with the second character by default.") + hintsCmd.Flags().Bool("ascending", false, "Make the hints increase from top to bottom, instead of decreasing from top to bottom.") + hintsCmd.Flags().String("customize-processing", "", "Name of a python file in the kitty config directory which will be imported to provide custom implementations for pattern finding and performing actions on selected matches. You can also specify absolute paths to load the script from elsewhere.") + hintsCmd.Flags().BoolP("help", "h", false, "Show help for this command") + hintsCmd.Flags().String("hints-background-color", "", "The background color for hints. You can use color names or hex values. For the eight basic named terminal colors you can also use the bright- prefix to get the bright variant of the color.") + hintsCmd.Flags().String("hints-foreground-color", "", "The foreground color for hints. You can use color names or hex values. For the eight basic named terminal colors you can also use the bright- prefix to get the bright variant of the color.") + hintsCmd.Flags().Int("hints-offset", 0, "The offset (from zero) at which to start hint numbering. Note that only numbers greater than or equal to zero are respected.") + hintsCmd.Flags().String("hints-text-color", "", "The foreground color for text pointed to by the hints. You can use color names or hex values. For the eight basic named terminal colors you can also use the bright- prefix to get the bright variant of the color. The default is to pick a suitable color automatically.") + hintsCmd.Flags().String("linenum-action", "", "Where to perform the action on matched errors. self means the current window, window a new kitty window, tab a new tab, os_window a new OS window and background run in the background. remote-control is like background but the program can use kitty remote control without needing to turn on remote control globally.") + hintsCmd.Flags().Int("minimum-match-length", 0, "The minimum number of characters to consider a match.") + hintsCmd.Flags().Bool("multiple", false, "Select multiple matches and perform the action on all of them together at the end. In this mode, press Esc to finish selecting.") + hintsCmd.Flags().String("multiple-joiner", "", "String for joining multiple selections when copying to the clipboard or inserting into the terminal. The special values are: space - a space character, newline - a newline, empty - an empty joiner, json - a JSON serialized list, auto - an automatic choice, based on the type of text being selected. In addition, integers are interpreted as zero-based indices into the list of selections. You can use 0 for the first selection and -1 for the last.") + hintsCmd.Flags().StringArray("program", nil, "What program to use to open matched text. Defaults to the default open program for the operating system. Various special values are supported: - (paste into terminal), @ (copy to clipboard), * (copy to primary selection), @NAME (copy to specified buffer), default (run default open program), launch (run the launch command). Can be specified multiple times to run multiple programs.") + hintsCmd.Flags().String("regex", "", "The regular expression to use when option --type is set to regex, in Perl 5 syntax. If you specify a numbered group in the regular expression, only the group will be matched. This allows you to match text ignoring a prefix/suffix, as needed. The default expression matches lines.") + hintsCmd.Flags().String("type", "", "The type of text to search for. A value of linenum is special, it looks for error messages using the pattern specified with --regex, which must have the named groups: path and line. If not specified, will look for path:line. The --linenum-action option controls where to display the selected error message, other options are ignored.") + hintsCmd.Flags().String("url-excluded-characters", "", "Characters to exclude when matching URLs. Defaults to the list of characters defined by the url_excluded_characters option in kitty.conf. The syntax for this option is the same as for url_excluded_characters.") + hintsCmd.Flags().String("url-prefixes", "", "Comma separated list of recognized URL prefixes. Defaults to the list of prefixes defined by the url_prefixes option in kitty.conf.") + hintsCmd.Flags().String("window-title", "", "The title for the hints window, default title is based on the type of text being hinted.") + hintsCmd.Flags().String("word-characters", "", "Characters to consider as part of a word. In addition, all characters marked as alphanumeric in the Unicode database will be considered as word characters. Defaults to the select_by_word_characters option from kitty.conf.") + rootCmd.AddCommand(hintsCmd) + + carapace.Gen(hintsCmd).FlagCompletion(carapace.ActionMap{ + "add-trailing-space": carapace.ActionValues("auto", "always", "never"), + "customize-processing": carapace.ActionFiles().Chdir("~/.config/kitty"), + "linenum-action": carapace.ActionValues("self", "background", "os_window", "remote-control", "tab", "window"), + "multiple-joiner": carapace.ActionValuesDescribed( + "space", "a space character", + "newline", "a newline", + "empty", "an empty joiner", + "json", "a JSON serialized list", + "auto", "an automatic choice, based on the type of text being selected", + ), + "program": carapace.ActionValues("-", "@", "*", "default", "launch"), + "type": carapace.ActionValues("url", "hash", "hyperlink", "ip", "line", "linenum", "path", "regex", "word"), + }) +} diff --git a/completers/common/kitten_completer/cmd/hyperlinkedGrep.go b/completers/common/kitten_completer/cmd/hyperlinkedGrep.go new file mode 100644 index 0000000000..e1ae877149 --- /dev/null +++ b/completers/common/kitten_completer/cmd/hyperlinkedGrep.go @@ -0,0 +1,23 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/carapace-sh/carapace-bridge/pkg/actions/bridge" + "github.com/spf13/cobra" +) + +var hyperlinkedGrepCmd = &cobra.Command{ + Use: "hyperlinked-grep", + Short: "Add hyperlinks to the output of ripgrep", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(hyperlinkedGrepCmd).Standalone() + + rootCmd.AddCommand(hyperlinkedGrepCmd) + + carapace.Gen(hyperlinkedGrepCmd).PositionalAnyCompletion( + bridge.ActionCarapace("ssh"), + ) +} diff --git a/completers/common/kitten_completer/cmd/icat.go b/completers/common/kitten_completer/cmd/icat.go new file mode 100644 index 0000000000..671caef9ef --- /dev/null +++ b/completers/common/kitten_completer/cmd/icat.go @@ -0,0 +1,54 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var icatCmd = &cobra.Command{ + Use: "icat", + Short: "Display images in the terminal", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(icatCmd).Standalone() + + icatCmd.Flags().String("align", "", "Horizontal alignment for the displayed image.") + icatCmd.Flags().String("background", "", "Specify a background color, this will cause transparent images to be") + icatCmd.Flags().Bool("clear", false, "Remove all images currently displayed on the screen. Note that this cannot work with terminal multiplexers such as tmux since only the multiplexer can know the position of the screen.") + icatCmd.Flags().Bool("clear-all", false, "Remove all images from screen and scrollback. Note that with terminal multiplexers like tmux, this will move images from all panes.") + icatCmd.Flags().Bool("detect-support", false, "Detect support for image display in the terminal. If not supported, will exit with exit code 1, otherwise will exit with code 0 and print the supported transfer mode to stderr, which can be used with the --transfer-mode option.") + icatCmd.Flags().Float64("detection-timeout", 0, "The amount of time (in seconds) to wait for a response from the terminal, when detecting image display support.") + icatCmd.Flags().String("engine", "", "The engine used for decoding and processing of images. The default is to use the most appropriate engine. The builtin engine uses Go's native imaging libraries. The magick engine uses ImageMagick which requires it to be installed on the system.") + icatCmd.Flags().String("fit", "", "When not using --place, control how the image is scaled relative to the screen. You can have it fit in the screen width or height or both or neither.") + icatCmd.Flags().Bool("hold", false, "Wait for a key press before exiting after displaying the images.") + icatCmd.Flags().Float64("image-id", 0, "The graphics protocol id to use for the created image. Normally, a random id is created if needed. This option allows control of the id. When multiple images are sent, sequential ids starting from the specified id are used. Valid ids are from 1 to 4294967295. Numbers outside this range are automatically wrapped.") + icatCmd.Flags().Float64P("loop", "l", 0, "Number of times to loop animations. Negative values loop forever. Zero means only the first frame of the animation is displayed. Otherwise, the animation is looped the specified number of times.") + icatCmd.Flags().String("mirror", "", "Mirror the image about a horizontal or vertical axis or both.") + icatCmd.Flags().BoolP("no-trailing-newline", "n", false, "By default, the cursor is moved to the next line after displaying an image. This option, prevents that. Should not be used when catting multiple images. Also has no effect when the --place option is used.") + icatCmd.Flags().String("passthrough", "", "Whether to surround graphics commands with escape sequences that allow them to passthrough programs like tmux. The default is to detect when running inside tmux and automatically use the tmux passthrough escape codes. Note that when this option is enabled it implies --unicode-placeholder as well.") + icatCmd.Flags().String("place", "", "Choose where on the screen to display the image. The image will be scaled to fit into the specified rectangle. The syntax for specifying rectangles is x@x. All measurements are in cells (i.e. cursor positions) with the origin (0, 0) at the top-left corner of the screen. Note that the --align option will horizontally align the image within this rectangle. By default, the image is horizontally centered within the rectangle. Using place will cause the cursor to be positioned at the top left corner of the image, instead of on the line after the image.") + icatCmd.Flags().Bool("print-window-size", false, "Print out the window size as x (in pixels) and quit. This is a convenience method to query the window size if using kitten icat from a scripting language that cannot make termios calls.") + icatCmd.Flags().Bool("scale-up", false, "Cause images that are smaller than the specified area to be scaled up to use as much of the specified area as possible. The specified area depends on either the --place or the --fit options.") + icatCmd.Flags().Bool("silent", false, "Not used, present for legacy compatibility.") + icatCmd.Flags().String("stdin", "", "Read image data from STDIN. The default is to do it automatically, when STDIN is not a terminal, but you can turn it off or on explicitly, if needed.") + icatCmd.Flags().String("transfer-mode", "", "Which mechanism to use to transfer images to the terminal. The default is to auto-detect. file means to use a temporary file, memory means to use shared memory, stream means to send the data via terminal escape codes. Note that if you use the file or memory transfer modes and you are connecting over a remote session then image display will not work.") + icatCmd.Flags().Bool("unicode-placeholder", false, "Use the Unicode placeholder method to display the images. Useful to display images from within full screen terminal programs that do not understand the kitty graphics protocol such as multiplexers or editors. See graphics_unicode_placeholders for details. Note that when using this method, images placed (with --place) that do not fit on the screen, will get wrapped at the screen edge instead of getting truncated. This wrapping is per line and therefore the image will look like it is interleaved with blank lines.") + icatCmd.Flags().String("use-window-size", "", "Instead of querying the terminal for the window size, use the specified size, which must be of the format: width_in_cells,height_in_cells,width_in_pixels,height_in_pixels") + icatCmd.Flags().Float64P("z-index", "z", 0, "Z-index of the image. When negative, text will be displayed on top of the image. Use a double minus for values under the threshold for drawing images under cell background colors. For example, --1 evaluates as -1,073,741,825.") + rootCmd.AddCommand(icatCmd) + + carapace.Gen(icatCmd).FlagCompletion(carapace.ActionMap{ + "align": carapace.ActionValues("center", "left", "right"), + "engine": carapace.ActionValues("auto", "builtin", "magick"), + "fit": carapace.ActionValues("width", "height", "both", "none"), + "mirror": carapace.ActionValues("none", "both", "horizontal", "vertical"), + "passthrough": carapace.ActionValues("detect", "none", "tmux"), + "stdin": carapace.ActionValues("detect", "no", "yes"), + "transfer-mode": carapace.ActionValues("detect", "file", "memory", "stream"), + }) + carapace.Gen(icatCmd).PositionalAnyCompletion( + carapace.Batch(carapace.ActionFiles(), carapace.ActionDirectories()).ToA(), + ) +} diff --git a/completers/common/kitten_completer/cmd/mouseDemo.go b/completers/common/kitten_completer/cmd/mouseDemo.go new file mode 100644 index 0000000000..d38f409466 --- /dev/null +++ b/completers/common/kitten_completer/cmd/mouseDemo.go @@ -0,0 +1,19 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var mouseDemoCmd = &cobra.Command{ + Use: "mouse-demo", + Short: "Demo the mouse handling kitty implements for terminal programs", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(mouseDemoCmd).Standalone() + + mouseDemoCmd.Flags().BoolP("help", "h", false, "Show help for this command") + rootCmd.AddCommand(mouseDemoCmd) +} diff --git a/completers/common/kitten_completer/cmd/notify.go b/completers/common/kitten_completer/cmd/notify.go new file mode 100644 index 0000000000..18b8434b61 --- /dev/null +++ b/completers/common/kitten_completer/cmd/notify.go @@ -0,0 +1,40 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var notifyCmd = &cobra.Command{ + Use: "notify", + Short: "Send notifications to the user", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(notifyCmd).Standalone() + + notifyCmd.Flags().StringP("app-name", "a", "", "The application name for the notification.") + notifyCmd.Flags().StringArrayP("button", "b", nil, "Add a button with the specified text to the notification. Can be specified multiple times for multiple buttons. If --wait-till-closed is used then the kitten will print the button number to STDOUT if the user clicks a button. 1 for the first button, 2 for the second button and so on.") + notifyCmd.Flags().StringP("expire-after", "e", "", "The duration, for the notification to appear on screen. The default is to use the policy of the OS notification service. A value of never means the notification should never expire, however, this may or may not work depending on the policies of the OS notification service. Time is specified in the form NUMBER[SUFFIX] where SUFFIX can be s for seconds, m for minutes, h for hours or d for days.") + notifyCmd.Flags().BoolP("help", "h", false, "Show help for this command") + notifyCmd.Flags().StringArrayP("icon", "n", nil, "The name of the icon to use for the notification. An icon with this name will be searched for on the computer running the terminal emulator. Can be specified multiple times, the first name that is found will be used. Standard names: error, file-manager, help, info, question, system-monitor, text-editor, warn, warning") + notifyCmd.Flags().StringP("icon-cache-id", "g", "", "Identifier to use when caching icons in the terminal emulator. Using an identifier means that icon data needs to be transmitted only once using --icon-path. Subsequent invocations will use the cached icon data, at least until the terminal instance is restarted. This is useful if this kitten is being used inside a larger application, with --only-print-escape-code.") + notifyCmd.Flags().StringP("icon-path", "p", "", "Path to an image file in PNG/JPEG/GIF formats to use as the icon. If both name and path are specified then first the name will be looked for and if not found then the path will be used.") + notifyCmd.Flags().StringP("identifier", "i", "", "The identifier of this notification. If a notification with the same identifier is already displayed, it is replaced/updated.") + notifyCmd.Flags().Bool("only-print-escape-code", false, "Only print the escape code to STDOUT. Useful if using this kitten as part of a larger application. If this is specified, the --wait-till-closed option will be used for escape code generation, but no actual waiting will be done.") + notifyCmd.Flags().StringP("print-identifier", "P", "", "Print the identifier for the notification to STDOUT. Useful when not specifying your own identifier via the --identifier option.") + notifyCmd.Flags().StringP("sound-name", "s", "", "The name of the sound to play with the notification. system means let the notification system use whatever sound it wants. silent means prevent any sound from being played. Any other value is passed to the desktop's notification system which may or may not honor it.") + notifyCmd.Flags().StringP("type", "t", "", "The notification type. Can be any string, it is used by users to create filter rules for notifications, so choose something descriptive of the notification's purpose.") + notifyCmd.Flags().StringP("urgency", "u", "", "The urgency of the notification.") + notifyCmd.Flags().BoolP("wait-for-completion", "w", false, "Wait until the notification is closed. If the user activates the notification, \"0\" is printed to STDOUT before quitting. If a button on the notification is pressed the number corresponding to the button is printed to STDOUT. Press the Esc or Ctrl+C keys to close the notification manually.") + notifyCmd.Flags().Bool("wait-till-closed", false, "Wait until the notification is closed. If the user activates the notification, \"0\" is printed to STDOUT before quitting. If a button on the notification is pressed the number corresponding to the button is printed to STDOUT. Press the Esc or Ctrl+C keys to close the notification manually.") + rootCmd.AddCommand(notifyCmd) + + carapace.Gen(notifyCmd).FlagCompletion(carapace.ActionMap{ + "icon": carapace.ActionValues("error", "file-manager", "help", "info", "question", "system-monitor", "text-editor", "warn", "warning"), + "icon-path": carapace.ActionFiles("png", "jpeg", "jpg", "gif"), + "sound-name": carapace.ActionValues("system", "silent"), + "urgency": carapace.ActionValues("normal", "critical", "low"), + }) +} diff --git a/completers/common/kitten_completer/cmd/panel.go b/completers/common/kitten_completer/cmd/panel.go new file mode 100644 index 0000000000..b93cb52752 --- /dev/null +++ b/completers/common/kitten_completer/cmd/panel.go @@ -0,0 +1,55 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var panelCmd = &cobra.Command{ + Use: "panel", + Short: "Use a command line program to draw a GPU accelerated panel on your desktop", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(panelCmd).Standalone() + + panelCmd.Flags().Float64("columns", 0, "The number of columns shown in the panel. Ignored for background, centered, and horizontal panels. If it has the suffix px then it sets the width of the panel in pixels instead of columns.") + panelCmd.Flags().StringP("config", "c", "", "Path to config file to use for kitty when drawing the panel.") + panelCmd.Flags().Bool("debug-input", false, "For internal debugging use.") + panelCmd.Flags().Bool("debug-rendering", false, "For internal debugging use.") + panelCmd.Flags().Bool("detach", false, "Detach from the controlling terminal, if any, running in an independent child process, the parent process exits immediately.") + panelCmd.Flags().String("detached-log", "", "Path to a log file to store STDOUT/STDERR when using --detach") + panelCmd.Flags().String("edge", "", "Which edge of the screen to place the panel on. Note that some window managers (such as i3) do not support placing docked windows on the left and right edges. The value background means make the panel the \"desktop wallpaper\". Note that when using sway if you set a background in your sway config it will cover the background drawn using this kitten. Additionally, there are three more values: center, center-sized and none. The value center anchors the panel to all sides and covers the entire display (on macOS the part of the display not covered by titlebar and dock). The panel can be shrunk and placed using the margin parameters. The value none anchors the panel to the top left corner and should be placed using the margin parameters. Its size is set by --lines and --columns. The value center-sized is just like none except that the panel is centered instead of in the top left corner and the margins have no effect.") + panelCmd.Flags().Float64("exclusive-zone", 0, "On a Wayland compositor that supports the wlr layer shell protocol, request a given exclusive zone for the panel. Please refer to the wlr layer shell documentation for more details on the meaning of exclusive and its value. If --edge is set to anything other than center or none, this flag will not have any effect unless the flag --override-exclusive-zone is also set. If --edge is set to background, this option has no effect. Ignored on X11 and macOS.") + panelCmd.Flags().String("focus-policy", "", "On a Wayland compositor that supports the wlr layer shell protocol, specify the focus policy for keyboard interactivity with the panel. Please refer to the wlr layer shell protocol documentation for more details. Note that different Wayland compositors behave very differently with exclusive, your mileage may vary. On macOS, exclusive and on-demand are currently the same.") + panelCmd.Flags().Bool("grab-keyboard", false, "Grab the keyboard. This means global shortcuts defined in the OS will be passed to kitty instead. Useful if you want to create an OS modal window. How well this works depends on the OS/window manager/desktop environment. On Wayland it works only if the compositor implements the inhibit-keyboard-shortcuts protocol. On macOS Apple doesn't allow applications to grab the keyboard without special permissions, so it doesn't work.") + panelCmd.Flags().BoolP("help", "h", false, "Show help for this command") + panelCmd.Flags().Bool("hide-on-focus-loss", false, "Automatically hide the panel window when it loses focus. Using this option will force --focus-policy to on-demand. Note that on Wayland, depending on the compositor, this can result in the window never becoming visible.") + panelCmd.Flags().String("instance-group", "", "Used in combination with the --single-instance option. All panel invocations with the same --instance-group will result in new panels being created in the first panel instance within that group.") + panelCmd.Flags().String("layer", "", "On a Wayland compositor that supports the wlr layer shell protocol, specifies the layer on which the panel should be drawn. This parameter is ignored and set to background if --edge is set to background. On macOS, maps these to appropriate NSWindow *levels*.") + panelCmd.Flags().Float64("lines", 0, "The number of lines shown in the panel. Ignored for background, centered, and vertical panels. If it has the suffix px then it sets the height of the panel in pixels instead of lines.") + panelCmd.Flags().String("listen-on", "", "Listen on the specified socket address for control messages. For example, --listen-on=unix:/tmp/mykitty or --listen-on=tcp:localhost:12345. On Linux systems, you can also use abstract UNIX sockets, not associated with a file, like this: --listen-on=unix:@mykitty. Environment variables are expanded and relative paths are resolved with respect to the temporary directory. To control kitty, you can send commands to it with kitten @ using the --to option to specify this address. Note that if you run kitten @ within a kitty window, there is no need to specify the --to option as it will automatically read from the environment. Note that this will be ignored unless allow_remote_control is set to either: yes, socket or socket-only. This can also be specified in kitty.conf.") + panelCmd.Flags().Float64("margin-bottom", 0, "Set the bottom margin for the panel, in pixels. Has no effect for top edge panels. Only works on macOS and Wayland compositors that supports the wlr layer shell protocol.") + panelCmd.Flags().Float64("margin-left", 0, "Set the left margin for the panel, in pixels. Has no effect for right edge panels. Only works on macOS and Wayland compositors that supports the wlr layer shell protocol.") + panelCmd.Flags().Float64("margin-right", 0, "Set the right margin for the panel, in pixels. Has no effect for left edge panels. Only works on macOS and Wayland compositors that supports the wlr layer shell protocol.") + panelCmd.Flags().Float64("margin-top", 0, "Set the top margin for the panel, in pixels. Has no effect for bottom edge panels. Only works on macOS and Wayland compositors that supports the wlr layer shell protocol.") + panelCmd.Flags().Bool("move-to-active-monitor", false, "When set and using --toggle-visibility to show an existing panel, the panel is moved to the active monitor (typically the monitor with the mouse on it). This works only if the underlying OS supports it. It is currently supported on macOS only.") + panelCmd.Flags().String("output-name", "", "The panel can only be displayed on a single monitor (output) at a time. This allows you to specify which output is used, by name. If not specified the compositor will choose an output automatically, typically the last output the user interacted with or the primary monitor. Use the special value list to get a list of available outputs. Use listjson for a json encoded output. Note that on Wayland the output can only be set at panel creation time, it cannot be changed after creation, nor is there anyway to display a single panel on all outputs. Please complain to the Wayland developers about this.") + panelCmd.Flags().StringArrayP("override", "o", nil, "Override individual kitty configuration options, can be specified multiple times. Syntax: name=value. For example: -o font_size=20") + panelCmd.Flags().Bool("override-exclusive-zone", false, "On a Wayland compositor that supports the wlr layer shell protocol, override the default exclusive zone. This has effect only if --edge is set to top, left, bottom or right. Ignored on X11 and macOS.") + panelCmd.Flags().BoolP("single-instance", "1", false, "If specified only a single instance of the panel will run. New invocations will instead create a new top-level window in the existing panel instance.") + panelCmd.Flags().Bool("start-as-hidden", false, "Start in hidden mode, useful with --toggle-visibility.") + panelCmd.Flags().Bool("toggle-visibility", false, "When set and using --single-instance will toggle the visibility of the existing panel rather than creating a new one.") + panelCmd.Flags().Bool("wait-for-single-instance-window-close", false, "Normally, when using --single-instance, kitty will open a new window in an existing instance and quit immediately. With this option, it will not quit till the newly opened window is closed. Note that if no previous instance is found, then kitty will wait anyway, regardless of this option.") + rootCmd.AddCommand(panelCmd) + + carapace.Gen(panelCmd).FlagCompletion(carapace.ActionMap{ + "edge": carapace.ActionValues("top", "background", "bottom", "center", "center-sized", "left", "none", "right"), + "focus-policy": carapace.ActionValues("not-allowed", "exclusive", "on-demand"), + "layer": carapace.ActionValues("bottom", "background", "overlay", "top"), + "listen-on": carapace.ActionValues("unix:", "tcp:").NoSpace(':'), + }) + + carapace.Gen(panelCmd).PositionalAnyCompletion(carapace.ActionFiles()) +} diff --git a/completers/common/kitten_completer/cmd/queryTerminal.go b/completers/common/kitten_completer/cmd/queryTerminal.go new file mode 100644 index 0000000000..f56b943d88 --- /dev/null +++ b/completers/common/kitten_completer/cmd/queryTerminal.go @@ -0,0 +1,38 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var queryTerminalCmd = &cobra.Command{ + Use: "query-terminal", + Short: "Query the terminal for various capabilities", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(queryTerminalCmd).Standalone() + + queryTerminalCmd.Flags().BoolP("help", "h", false, "Show help for this command") + queryTerminalCmd.Flags().Float64("wait-for", 0, "The amount of time (in seconds) to wait for a response from the terminal, after querying it.") + rootCmd.AddCommand(queryTerminalCmd) + + carapace.Gen(queryTerminalCmd).PositionalAnyCompletion(carapace.ActionValuesDescribed( + "name", "Terminal name (e.g. xterm-kitty)", + "version", "Terminal version (e.g. 0.45.0)", + "allow_hyperlinks", "The config option allow_hyperlinks in kitty.conf for allowing hyperlinks can be yes, no or ask", + "font_family", "The current font's PostScript name", + "bold_font", "The current bold font's PostScript name", + "italic_font", "The current italic font's PostScript name", + "bold_italic_font", "The current bold-italic font's PostScript name", + "font_size", "The current font size in pts", + "dpi_x", "The current DPI on the x-axis", + "dpi_y", "The current DPI on the y-axis", + "foreground", "The current foreground color as a 24-bit # color code", + "background", "The current background color as a 24-bit # color code", + "background_opacity", "The current background opacity as a number between 0 and 1", + "clipboard_control", "The config option clipboard_control in kitty.conf for allowing reads/writes to/from the clipboard", + "os_name", "The name of the OS the terminal is running on. kitty returns values: bsd, linux, macos, unknown", + )) +} diff --git a/completers/common/kitten_completer/cmd/quickAccessTerminal.go b/completers/common/kitten_completer/cmd/quickAccessTerminal.go new file mode 100644 index 0000000000..a843763970 --- /dev/null +++ b/completers/common/kitten_completer/cmd/quickAccessTerminal.go @@ -0,0 +1,32 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var quickAccessTerminalCmd = &cobra.Command{ + Use: "quick-access-terminal", + Short: "A quick access terminal window that you can bring up instantly with a keypress or a command.", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(quickAccessTerminalCmd).Standalone() + + quickAccessTerminalCmd.Flags().StringArrayP("config", "c", nil, "Specify a path to the configuration file(s) to use. All configuration files are merged onto the builtin quick-access-terminal.conf, overriding the builtin values. This option can be specified multiple times to read multiple configuration files in sequence, which are merged. Use the special value NONE to not load any config file.") + quickAccessTerminalCmd.Flags().Bool("debug-input", false, "For debugging interactions with the compositor/window manager.") + quickAccessTerminalCmd.Flags().Bool("debug-rendering", false, "For debugging interactions with the compositor/window manager.") + quickAccessTerminalCmd.Flags().Bool("detach", false, "Detach from the controlling terminal, if any, running in an independent child process, the parent process exits immediately.") + quickAccessTerminalCmd.Flags().String("detached-log", "", "Path to a log file to store STDOUT/STDERR when using --detach") + quickAccessTerminalCmd.Flags().BoolP("help", "h", false, "Show help for this command") + quickAccessTerminalCmd.Flags().String("instance-group", "", "The unique name of this quick access terminal Use a different name if you want multiple such terminals.") + quickAccessTerminalCmd.Flags().StringArrayP("override", "o", nil, "Override individual configuration options, can be specified multiple times. Syntax: name=value. For example: -o lines=12") + rootCmd.AddCommand(quickAccessTerminalCmd) + + carapace.Gen(quickAccessTerminalCmd).FlagCompletion(carapace.ActionMap{ + "config": carapace.Batch(carapace.ActionFiles(), carapace.ActionValues("NONE", "-", "/dev/stdin")).ToA(), + }) + + carapace.Gen(quickAccessTerminalCmd).PositionalAnyCompletion(carapace.ActionFiles()) +} diff --git a/completers/common/kitten_completer/cmd/root.go b/completers/common/kitten_completer/cmd/root.go new file mode 100644 index 0000000000..b0065da575 --- /dev/null +++ b/completers/common/kitten_completer/cmd/root.go @@ -0,0 +1,24 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var rootCmd = &cobra.Command{ + Use: "kitten", + Short: "kitten serves as a launcher for running individual kittens", + Long: "https://sw.kovidgoyal.net/kitty/kittens_intro/", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func Execute() error { + return rootCmd.Execute() +} + +func init() { + carapace.Gen(rootCmd).Standalone() + + rootCmd.Flags().BoolP("help", "h", false, "Show help for this command") + rootCmd.Flags().Bool("version", false, "The current kitten version") +} diff --git a/completers/common/kitten_completer/cmd/runShell.go b/completers/common/kitten_completer/cmd/runShell.go new file mode 100644 index 0000000000..d502fa738d --- /dev/null +++ b/completers/common/kitten_completer/cmd/runShell.go @@ -0,0 +1,30 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var runShellCmd = &cobra.Command{ + Use: "run-shell", + Short: "Run the user's shell with shell integration enabled", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(runShellCmd).Standalone() + + runShellCmd.Flags().String("cwd", "", "The working directory to use when executing the shell.") + runShellCmd.Flags().StringArray("env", nil, "Specify an env var to set before running the shell. Of the form KEY=VAL. Can be specified multiple times. If no = is present KEY is unset.") + runShellCmd.Flags().BoolP("help", "h", false, "Show help for this command") + runShellCmd.Flags().String("inject-self-onto-path", "", "Add the directory containing this kitten binary to PATH. Directory is added only if not already present.") + runShellCmd.Flags().String("shell", "", "Specify the shell command to run. The default value of . will use the parent shell if recognized, falling back to the value of the shell option from kitty.conf.") + runShellCmd.Flags().String("shell-integration", "", "Specify a value for the shell_integration option, overriding the one from kitty.conf.") + rootCmd.AddCommand(runShellCmd) + + carapace.Gen(runShellCmd).FlagCompletion(carapace.ActionMap{ + "inject-self-onto-path": carapace.ActionValues("always", "never", "unless-root"), + }) + + carapace.Gen(runShellCmd).PositionalAnyCompletion(carapace.ActionFiles()) +} diff --git a/completers/common/kitten_completer/cmd/showKey.go b/completers/common/kitten_completer/cmd/showKey.go new file mode 100644 index 0000000000..7879787730 --- /dev/null +++ b/completers/common/kitten_completer/cmd/showKey.go @@ -0,0 +1,24 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var showKeyCmd = &cobra.Command{ + Use: "show-key", + Short: "Show the codes generated by the terminal for key presses in various keyboard modes", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(showKeyCmd).Standalone() + + showKeyCmd.Flags().BoolP("help", "h", false, "Show help for this command") + showKeyCmd.Flags().StringP("key-mode", "m", "", "The keyboard mode to use when showing keys. normal mode is with DECCKM reset and application mode is with DECCKM set. kitty is the full kitty extended keyboard protocol.") + rootCmd.AddCommand(showKeyCmd) + + carapace.Gen(showKeyCmd).FlagCompletion(carapace.ActionMap{ + "key-mode": carapace.ActionValues("normal", "application", "kitty", "unchanged"), + }) +} diff --git a/completers/common/kitten_completer/cmd/ssh.go b/completers/common/kitten_completer/cmd/ssh.go new file mode 100644 index 0000000000..68780381e3 --- /dev/null +++ b/completers/common/kitten_completer/cmd/ssh.go @@ -0,0 +1,24 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/carapace-sh/carapace-bridge/pkg/actions/bridge" + "github.com/spf13/cobra" +) + +var sshCmd = &cobra.Command{ + Use: "ssh", + Short: "Truly convenient SSH", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(sshCmd).Standalone() + + sshCmd.Flags().BoolP("help", "h", false, "Show help for this command") + rootCmd.AddCommand(sshCmd) + + carapace.Gen(sshCmd).PositionalAnyCompletion( + bridge.ActionCarapace("ssh"), + ) +} diff --git a/completers/common/kitten_completer/cmd/themes.go b/completers/common/kitten_completer/cmd/themes.go new file mode 100644 index 0000000000..5a443b5ef3 --- /dev/null +++ b/completers/common/kitten_completer/cmd/themes.go @@ -0,0 +1,28 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var themesCmd = &cobra.Command{ + Use: "themes", + Short: "Manage kitty color schemes easily", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(themesCmd).Standalone() + + themesCmd.Flags().Float64("cache-age", 0, "Check for new themes only after the specified number of days. A value of zero will always check for new themes. A negative value will never check for new themes, instead raising an error if a local copy of the themes is not available.") + themesCmd.Flags().String("config-file-name", "", "The name or path to the config file to edit. Relative paths are interpreted with respect to the kitty config directory. By default the kitty config file, kitty.conf is edited. This is most useful if you add include themes.conf to your kitty.conf and then have the kitten operate only on themes.conf, allowing kitty.conf to remain unchanged.") + themesCmd.Flags().Bool("dump-theme", false, "When running non-interactively, dump the specified theme to STDOUT instead of changing kitty.conf.") + themesCmd.Flags().BoolP("help", "h", false, "Show help for this command") + themesCmd.Flags().String("reload-in", "", "By default, this kitten will signal only the parent kitty instance it is running in to reload its config, after making changes. Use this option to instead either not reload the config at all or in all running kitty instances.") + rootCmd.AddCommand(themesCmd) + + carapace.Gen(themesCmd).FlagCompletion(carapace.ActionMap{ + "config-file-name": carapace.ActionFiles("~/.config/kitty"), + "reload-in": carapace.ActionValues("parent", "all", "none"), + }) +} diff --git a/completers/common/kitten_completer/cmd/transfer.go b/completers/common/kitten_completer/cmd/transfer.go new file mode 100644 index 0000000000..891cdf0bf9 --- /dev/null +++ b/completers/common/kitten_completer/cmd/transfer.go @@ -0,0 +1,38 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var transferCmd = &cobra.Command{ + Use: "transfer", + Short: "Transfer files easily over the TTY device", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(transferCmd).Standalone() + + transferCmd.Flags().String("compress", "", "Whether to compress data being sent. By default compression is enabled based on the type of file being sent. For files recognized as being already compressed, compression is turned off as it just wastes CPU cycles.") + transferCmd.Flags().StringP("confirm-paths", "c", "", "Before actually transferring files, show a mapping of local file names to remote file names and ask for confirmation.") + transferCmd.Flags().StringP("direction", "d", "", "Whether to send or receive files. send or download copy files from the computer on which the kitten is running (usually the remote computer) to the local computer. receive or upload copy files from the local computer to the remote computer.") + transferCmd.Flags().BoolP("help", "h", false, "Show help for this command") + transferCmd.Flags().StringP("mode", "m", "", "How to interpret command line arguments. In mirror mode all arguments are assumed to be files/dirs on the sending computer and they are mirrored onto the receiving computer. Files under the HOME directory are copied to the HOME directory on the receiving computer even if the HOME directory is different. In normal mode the last argument is assumed to be a destination path on the receiving computer. The last argument must be an existing directory unless copying a single file. When it is a directory it should end with a trailing slash.") + transferCmd.Flags().StringP("permissions-bypass", "p", "", "The password to use to skip the transfer confirmation popup in kitty. Must match the password set for the file_transfer_confirmation_bypass option in kitty.conf. Note that leading and trailing whitespace is removed from the password. A password starting with ., / or ~ characters is assumed to be a file name to read the password from. A value of - means read the password from STDIN. A password that is purely a number less than 256 is assumed to be the number of a file descriptor from which to read the actual password.") + transferCmd.Flags().BoolP("transmit-deltas", "x", false, "If a file on the receiving side already exists, use the rsync algorithm to update it to match the file on the sending side, potentially saving lots of bandwidth and also automatically resuming partial transfers. Note that this will actually degrade performance on fast links or with small files, so use with care.") + rootCmd.AddCommand(transferCmd) + + carapace.Gen(transferCmd).FlagCompletion(carapace.ActionMap{ + "compress": carapace.ActionValues("auto", "always", "never"), + "confirm-paths": carapace.ActionValues("yes", "no"), + "direction": carapace.ActionValues("download", "receive", "send", "upload"), + "mode": carapace.ActionValues("normal", "mirror"), + "transmit-deltas": carapace.ActionValues("yes", "no"), + }) + + carapace.Gen(transferCmd).PositionalAnyCompletion(carapace.Batch( + carapace.ActionFiles(), + carapace.ActionDirectories(), + ).ToA()) +} diff --git a/completers/common/kitten_completer/cmd/unicodeInput.go b/completers/common/kitten_completer/cmd/unicodeInput.go new file mode 100644 index 0000000000..0441d0f6b0 --- /dev/null +++ b/completers/common/kitten_completer/cmd/unicodeInput.go @@ -0,0 +1,26 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var unicodeInputCmd = &cobra.Command{ + Use: "unicode-input", + Short: "Browse and select unicode characters by name", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(unicodeInputCmd).Standalone() + + unicodeInputCmd.Flags().String("emoji-variation", "", "Whether to use the textual or the graphical form for emoji. By default the default form specified in the Unicode standard for the symbol is used.") + unicodeInputCmd.Flags().BoolP("help", "h", false, "Show help for this command") + unicodeInputCmd.Flags().String("tab", "", "The initial tab to display. Defaults to using the tab from the previous kitten invocation.") + rootCmd.AddCommand(unicodeInputCmd) + + carapace.Gen(unicodeInputCmd).FlagCompletion(carapace.ActionMap{ + "emoji-variation": carapace.ActionValues("none", "graphic", "text"), + "tab": carapace.ActionValues("previous", "code", "emoticons", "favorites", "name"), + }) +} diff --git a/completers/common/kitten_completer/cmd/updateSelf.go b/completers/common/kitten_completer/cmd/updateSelf.go new file mode 100644 index 0000000000..b8b021fd22 --- /dev/null +++ b/completers/common/kitten_completer/cmd/updateSelf.go @@ -0,0 +1,24 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var updateSelfCmd = &cobra.Command{ + Use: "update-self", + Short: "Update this kitten binary", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(updateSelfCmd).Standalone() + + updateSelfCmd.Flags().String("fetch-version", "", "The version to fetch. The special words latest and nightly fetch the latest stable and nightly release respectively. Other values can be, for example: 0.45.0.") + updateSelfCmd.Flags().BoolP("help", "h", false, "Show help for this command") + rootCmd.AddCommand(updateSelfCmd) + + carapace.Gen(updateSelfCmd).FlagCompletion(carapace.ActionMap{ + "fetch-version": carapace.ActionValues("latest", "nightly"), + }) +} diff --git a/completers/common/kitten_completer/main.go b/completers/common/kitten_completer/main.go new file mode 100644 index 0000000000..5ffea35a2c --- /dev/null +++ b/completers/common/kitten_completer/main.go @@ -0,0 +1,7 @@ +package main + +import "github.com/carapace-sh/carapace-bin/completers/common/kitten_completer/cmd" + +func main() { + cmd.Execute() +} diff --git a/pkg/actions/tools/kitty/action.go b/pkg/actions/tools/kitty/action.go new file mode 100644 index 0000000000..6beaf015ef --- /dev/null +++ b/pkg/actions/tools/kitty/action.go @@ -0,0 +1,151 @@ +package kitty + +import "github.com/carapace-sh/carapace" + +// ActionActions completes actions +// +// clear_selection (Clear the current selection) +// show_scrollback (Show scrollback in a pager like less.) +func ActionActions() carapace.Action { + // see https://sw.kovidgoyal.net/kitty/actions/ + return carapace.ActionValuesDescribed( + "clear_selection", "Clear the current selection.", + "copy_and_clear_or_interrupt", "Copy the selected text from the active window to the clipboard and clear the selection; if no selection, send SIGINT.", + "copy_ansi_to_clipboard", "Copy the selected text from the active window to the clipboard with ANSI formatting codes.", + "copy_last_command_output", "Copy the last non-empty output from a shell command to the clipboard. Requires shell integration.", + "copy_or_interrupt", "Copy the selected text from the active window to the clipboard; if no selection, send SIGINT.", + "copy_or_noop", "Copy the selected text from the active window to the clipboard; if no selection, pass the key through to the application.", + "copy_to_clipboard", "Copy the selected text from the active window to the clipboard.", + "pass_selection_to_program", "Pass the selected text from the active window to the specified program.", + "paste", "Paste the specified text into the current window; ANSI C escapes are decoded.", + "search_scrollback", "Search scrollback in a pager like less; if text is selected, it is searched for. Assumes / triggers search in the configured pager.", + "show_first_command_output_on_screen", "Show output from the first shell command on screen in a pager like less. Requires shell integration.", + "show_last_command_output", "Show output from the last shell command in a pager like less. Requires shell integration.", + "show_last_non_empty_command_output", "Show the last non-empty output from a shell command in a pager like less. Requires shell integration.", + "show_last_visited_command_output", "Show the first command output below the last scrolled position via scroll_to_prompt, or the last mouse-clicked command output, in a pager like less. Requires shell integration.", + "show_scrollback", "Show scrollback in a pager like less.", + "copy_to_buffer", "Copy the selection from the active window to the specified buffer.", + "paste_from_buffer", "Paste from the specified buffer to the active window.", + "paste_from_clipboard", "Paste from the clipboard to the active window.", + "paste_from_selection", "Paste from the primary selection if present, otherwise from the clipboard to the active window.", + "dump_lines_with_attrs", "Show a dump of the current lines in the scrollback and screen with their line attributes.", + "close_shared_ssh_connections", "Close all shared SSH connections.", + "debug_config", "Show the effective configuration kitty is running with.", + "show_kitty_env_vars", "Show the environment variables that the kitty process sees.", + "simulate_color_scheme_preference_change", "Simulate a change in OS color scheme preference.", + "goto_layout", "Switch to the named layout. If multiple layouts share the name, specify the full definition or a unique prefix.", + "last_used_layout", "Go to the previously used layout.", + "layout_action", "Perform a layout-specific action.", + "next_layout", "Go to the next enabled layout; optionally jump by a specified number.", + "toggle_layout", "Toggle the named layout, switching to it if another is current or back to the last used layout.", + "remove_marker", "Remove a previously created marker.", + "scroll_to_mark", "Scroll to the next or previous mark of the specified type.", + "toggle_marker", "Toggle the current marker on or off.", + "create_marker", "Create a new marker.", + "send_key", "Send the specified keys to the active window (press and release); works only if the program’s keyboard mode supports it.", + "send_text", "Send the specified text to the active window.", + "show_kitty_doc", "Display the specified kitty documentation, preferring a local copy if found.", + "signal_child", "Send the specified signal to the foreground process in the active window.", + "clear_terminal", "Clear the terminal (various modes available; see reset_terminal for details).", + "combine", "Combine multiple actions and map them to a single keypress.", + "disable_ligatures_in", "Turn ligatures on or off in the specified window.", + "discard_event", "Discard this event, ignoring it completely.", + "edit_config_file", "Edit the kitty.conf config file in your preferred text editor.", + "grab_keyboard", "Grab the keyboard so OS global shortcuts are passed to kitty; support depends on OS/window manager (not permitted on macOS without special permissions).", + "hide_macos_app", "Hide the macOS kitty application.", + "hide_macos_other_apps", "Hide other macOS applications.", + "input_unicode_character", "Input an arbitrary Unicode character.", + "kitten", "Run the specified kitten.", + "kitty_shell", "Run the kitty shell to control kitty with commands.", + "launch", "Launch the specified program in a new window, tab, etc.", + "load_config_file", "Reload the config file; without arguments reloads the default, otherwise loads specified files and replaces all options.", + "macos_cycle_through_os_windows", "Cycle through OS windows on macOS.", + "macos_cycle_through_os_windows_backwards", "Cycle backwards through OS windows on macOS.", + "minimize_macos_window", "Minimize the macOS window.", + "open_url", "Open the specified URL.", + "open_url_with_hints", "Click a URL using the keyboard.", + "pop_keyboard_mode", "End the current keyboard mode and switch to the previous mode.", + "push_keyboard_mode", "Switch to the specified keyboard mode, pushing it onto the stack.", + "remote_control", "Run a remote control command without needing to allow remote control.", + "remote_control_script", "Run a remote control script without needing to allow remote control.", + "set_colors", "Change colors in the specified windows.", + "show_error", "Show an error message with the specified title and text.", + "sleep", "Sleep for a specified duration; supports s, m, h, d suffixes and fractional times.", + "toggle_macos_secure_keyboard_entry", "Toggle macOS secure keyboard entry.", + "ungrab_keyboard", "Ungrab the keyboard if it was previously grabbed.", + "no_op", "Unbind a shortcut so the keystroke is passed to the application.", + "mouse_click_url", "Click the URL under the mouse.", + "mouse_click_url_or_select", "Click the URL under the mouse only if there is no selection on the screen.", + "mouse_handle_click", "Handle a mouse click by trying actions in order until one succeeds: selection, link, prompt.", + "mouse_select_command_output", "Select the clicked command output. Requires shell integration.", + "mouse_selection", "Manipulate the selection based on the current mouse position.", + "mouse_show_command_output", "Show clicked command output in a pager like less. Requires shell integration.", + "paste_selection", "Paste the current primary selection.", + "paste_selection_or_clipboard", "Paste the current primary selection or the clipboard if no selection is present.", + "scroll_end", "Scroll to the bottom of the scrollback buffer when in the main screen.", + "scroll_home", "Scroll to the top of the scrollback buffer when in the main screen.", + "scroll_line_down", "Scroll down by one line when in the main screen.", + "scroll_line_up", "Scroll up by one line when in the main screen.", + "scroll_page_down", "Scroll down by one page when in the main screen.", + "scroll_page_up", "Scroll up by one page when in the main screen.", + "scroll_prompt_to_bottom", "Scroll the prompt to the bottom of the screen, filling extra lines from the scrollback, when in the main screen.", + "scroll_prompt_to_top", "Scroll the prompt to the top of the screen, filling the screen with empty lines, when in the main screen; optionally avoid moving lines above the prompt into scrollback.", + "scroll_to_prompt", "Scroll to the previous or next shell command prompt; supports optional count and context lines. Requires shell integration.", + "close_session", "Close a session (close all windows that belong to the session).", + "goto_session", "Switch to the specified session, creating it if not already present.", + "save_as_session", "Save the current kitty state as a session file.", + "close_other_tabs_in_os_window", "Close all tabs in the current OS window except the active tab.", + "close_tab", "Close the current tab.", + "detach_tab", "Detach a tab, moving it to another OS window.", + "goto_tab", "Go to the specified tab by number (starting at 1); zero or negative numbers go to previously active tabs.", + "move_tab_backward", "Move the active tab backward.", + "move_tab_forward", "Move the active tab forward.", + "new_tab", "Create a new tab.", + "new_tab_with_cwd", "Create a new tab with the working directory set to that of the active window; added to the current session if any.", + "next_tab", "Make the next tab active.", + "previous_tab", "Make the previous tab active.", + "select_tab", "Interactively select a tab to switch to.", + "set_tab_title", "Change the title of the active tab interactively or set a title via argument; empty string resets; a space avoids prefill.", + "set_window_title", "Change the title of the active window interactively or set a title via argument; empty string resets; a space avoids prefill.", + "close_other_windows_in_tab", "Close all windows in the tab except the active window.", + "eighth_window", "Focus the eighth window.", + "fifth_window", "Focus the fifth window.", + "first_window", "Focus the first window.", + "focus_visible_window", "Focus a visible window by pressing its displayed number in visual selection mode.", + "fourth_window", "Focus the fourth window.", + "move_window", "Move the window in the specified direction.", + "move_window_backward", "Move the active window backward (swap with the previous window).", + "move_window_forward", "Move the active window forward (swap with the next window).", + "move_window_to_top", "Move the active window to the top (make it the first window).", + "neighboring_window", "Focus the neighboring window in the current tab.", + "next_window", "Focus the next window in the current tab.", + "ninth_window", "Focus the ninth window.", + "nth_window", "Focus the nth window if positive, or previously active windows if negative; if the number exceeds the window count, focus the last window.", + "previous_window", "Focus the previous window in the current tab.", + "reset_window_sizes", "Reset window sizes, undoing any dynamic resizing.", + "resize_window", "Resize the active window by the specified amount.", + "second_window", "Focus the second window.", + "seventh_window", "Focus the seventh window.", + "sixth_window", "Focus the sixth window.", + "swap_with_window", "Swap the current window with another window in the current tab, selected visually.", + "tenth_window", "Focus the tenth window.", + "third_window", "Focus the third window.", + "change_font_size", "Change the font size for the current or all OS windows.", + "close_os_window", "Close the currently active OS window.", + "close_other_os_windows", "Close all other OS windows except the one containing the active window.", + "close_window", "Close the currently active window.", + "close_window_with_confirmation", "Close the window with confirmation; can ignore confirmation at a shell prompt with an option. Requires shell integration for prompt detection.", + "detach_window", "Detach a window, moving it to another tab or OS window.", + "new_os_window", "Create a new OS window.", + "new_os_window_with_cwd", "Create a new OS window with the same working directory as the active window; added to the current session if any.", + "new_window", "Create a new window.", + "new_window_with_cwd", "Create a new window with the same working directory as the active window; added to the current session if any.", + "nth_os_window", "Focus the nth OS window if positive or the previously active ones if negative; zero refocuses the current OS window (if the window manager allows grabbing focus).", + "quit", "Quit kitty, closing all windows.", + "set_background_opacity", "Set the background opacity for the active OS window (supports relative and absolute values).", + "start_resizing_window", "Interactively resize the active window.", + "toggle_fullscreen", "Toggle the fullscreen status of the active OS window.", + "toggle_maximized", "Toggle the maximized status of the active OS window.", + "toggle_tab", "Toggle to the tab matching the specified expression, or switch back to the last used tab within the same OS window.", + ).Tag("actions") +}