Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Oct 15, 2023
1 parent 865bc21 commit 9642119
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions completers/wezterm_completer/cmd/cli_spawn.go
Original file line number Diff line number Diff line change
@@ -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"))),
)
}

0 comments on commit 9642119

Please sign in to comment.