Skip to content

Commit 6d7b3cf

Browse files
committed
ghostty: add new subcommands
1 parent 58dd287 commit 6d7b3cf

File tree

4 files changed

+92
-0
lines changed

4 files changed

+92
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var booCmd = &cobra.Command{
9+
Use: "+boo",
10+
Short: "The `boo` command is used to display the animation from the Ghostty website in the terminal",
11+
Run: func(cmd *cobra.Command, args []string) {},
12+
}
13+
14+
func init() {
15+
carapace.Gen(booCmd).Standalone()
16+
17+
rootCmd.AddCommand(booCmd)
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var editConfigCmd = &cobra.Command{
9+
Use: "+edit-config",
10+
Short: "The `edit-config` command opens the Ghostty configuration file",
11+
Run: func(cmd *cobra.Command, args []string) {},
12+
}
13+
14+
func init() {
15+
carapace.Gen(editConfigCmd).Standalone()
16+
17+
rootCmd.AddCommand(editConfigCmd)
18+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/carapace-sh/carapace-bridge/pkg/actions/bridge"
6+
"github.com/spf13/cobra"
7+
)
8+
9+
var newWindowCmd = &cobra.Command{
10+
Use: "+new-window",
11+
Short: "The `new-window` will use native platform IPC to open up a new window in a running instance of Ghostty",
12+
Run: func(cmd *cobra.Command, args []string) {},
13+
}
14+
15+
func init() {
16+
carapace.Gen(newWindowCmd).Standalone()
17+
newWindowCmd.Flags().SetInterspersed(false)
18+
19+
newWindowCmd.Flags().String("class", "", "If set, open up a new window in a custom instance of Ghostty")
20+
newWindowCmd.Flags().BoolS("e", "e", false, "Any arguments after this will be interpreted as a command to execute")
21+
rootCmd.AddCommand(newWindowCmd)
22+
23+
carapace.Gen(newWindowCmd).PositionalAnyCompletion(
24+
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
25+
if newWindowCmd.Flag("e").Changed {
26+
return bridge.ActionCarapaceBin()
27+
}
28+
return carapace.ActionValues()
29+
}),
30+
)
31+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var sshCacheCmd = &cobra.Command{
9+
Use: "+ssh-cache",
10+
Short: "Manage the SSH terminfo cache for automatic remote host setup",
11+
Run: func(cmd *cobra.Command, args []string) {},
12+
}
13+
14+
func init() {
15+
carapace.Gen(sshCacheCmd).Standalone()
16+
17+
sshCacheCmd.Flags().String("add", "", "Manually add host to cache")
18+
sshCacheCmd.Flags().Bool("clear", false, "Clear entire cache")
19+
sshCacheCmd.Flags().String("expire-days", "", "Set custom expiration period")
20+
sshCacheCmd.Flags().String("host", "", "Check if host is cached")
21+
sshCacheCmd.Flags().String("remove", "", "Remove host from cache")
22+
rootCmd.AddCommand(sshCacheCmd)
23+
24+
sshCacheCmd.MarkFlagsMutuallyExclusive("clear", "add", "remove", "host")
25+
}

0 commit comments

Comments
 (0)