From 96421191266a0dbfa4a4c8ef878cfa91e7544047 Mon Sep 17 00:00:00 2001 From: rsteube Date: Mon, 16 Oct 2023 00:05:49 +0200 Subject: [PATCH] tmp --- completers/wezterm_completer/cmd/cli_spawn.go | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 completers/wezterm_completer/cmd/cli_spawn.go diff --git a/completers/wezterm_completer/cmd/cli_spawn.go b/completers/wezterm_completer/cmd/cli_spawn.go new file mode 100644 index 0000000000..29c8be001f --- /dev/null +++ b/completers/wezterm_completer/cmd/cli_spawn.go @@ -0,0 +1,39 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/wezterm" + "github.com/rsteube/carapace-bridge/pkg/actions/bridge" + "github.com/rsteube/carapace/pkg/traverse" + "github.com/spf13/cobra" +) + +var cli_spawnCmd = &cobra.Command{ + Use: "spawn", + Short: "Spawn a command into a new window or tab", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(cli_spawnCmd).Standalone() + cli_spawnCmd.Flags().SetInterspersed(false) + + cli_spawnCmd.Flags().String("cwd", "", "Specify the current working directory for the initially spawned program") + cli_spawnCmd.Flags().String("domain-name", "", "") + cli_spawnCmd.Flags().BoolP("help", "h", false, "Print help") + cli_spawnCmd.Flags().Bool("new-window", false, "Spawn into a new window, rather than a new tab") + cli_spawnCmd.Flags().String("pane-id", "", "Specify the current pane") + cli_spawnCmd.Flags().String("window-id", "", "Specify the window into which to spawn a tab") + cli_spawnCmd.Flags().String("workspace", "", "Override the default workspace name with the provided name") + cliCmd.AddCommand(cli_spawnCmd) + + // TODO flag completion + carapace.Gen(cli_spawnCmd).FlagCompletion(carapace.ActionMap{ + "cwd": carapace.ActionDirectories(), + "pane-id": wezterm.ActionPanes(), + }) + + carapace.Gen(cli_spawnCmd).PositionalAnyCompletion( + bridge.ActionCarapaceBin().ChdirF(traverse.Flag(cli_spawnCmd.Flag("cwd"))), + ) +}