diff --git a/completers/vhs_completer/cmd/help.go b/completers/vhs_completer/cmd/help.go new file mode 100644 index 0000000000..f55758d2d7 --- /dev/null +++ b/completers/vhs_completer/cmd/help.go @@ -0,0 +1,17 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var helpCmd = &cobra.Command{ + Use: "help", + Short: "Help about any command", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(helpCmd).Standalone() + rootCmd.AddCommand(helpCmd) +} diff --git a/completers/vhs_completer/cmd/new.go b/completers/vhs_completer/cmd/new.go new file mode 100644 index 0000000000..b7fccfa128 --- /dev/null +++ b/completers/vhs_completer/cmd/new.go @@ -0,0 +1,21 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var newCmd = &cobra.Command{ + Use: "new", + Short: "Create a new tape file with example tape file contents and documentation", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(newCmd).Standalone() + rootCmd.AddCommand(newCmd) + + carapace.Gen(rootCmd).PositionalCompletion( + carapace.ActionFiles(), + ) +} diff --git a/completers/vhs_completer/cmd/root.go b/completers/vhs_completer/cmd/root.go new file mode 100644 index 0000000000..cd0adea800 --- /dev/null +++ b/completers/vhs_completer/cmd/root.go @@ -0,0 +1,27 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var rootCmd = &cobra.Command{ + Use: "vhs", + Short: "Run a given tape file and generates its outputs.", + Long: "https://github.com/charmbracelet/vhs", + 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, "help for vhs") + rootCmd.Flags().BoolP("version", "v", false, "version for vhs") + + carapace.Gen(rootCmd).PositionalCompletion( + carapace.ActionFiles(".tape"), + ) +} diff --git a/completers/vhs_completer/cmd/serve.go b/completers/vhs_completer/cmd/serve.go new file mode 100644 index 0000000000..8c6ef85b44 --- /dev/null +++ b/completers/vhs_completer/cmd/serve.go @@ -0,0 +1,24 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/net" + "github.com/spf13/cobra" +) + +var serveCmd = &cobra.Command{ + Use: "serve", + Short: "Start the VHS SSH server", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(serveCmd).Standalone() + serveCmd.Flags().StringP("host", "l", "0.0.0.0", "host to listen on") + serveCmd.Flags().IntP("port", "p", 1976, "port to listen on") + rootCmd.AddCommand(serveCmd) + + carapace.Gen(serveCmd).FlagCompletion(carapace.ActionMap{ + "port": net.ActionPorts(), + }) +} diff --git a/completers/vhs_completer/cmd/validate.go b/completers/vhs_completer/cmd/validate.go new file mode 100644 index 0000000000..5f0ab28715 --- /dev/null +++ b/completers/vhs_completer/cmd/validate.go @@ -0,0 +1,21 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var validateCmd = &cobra.Command{ + Use: "validate", + Short: "Validate a glob file path and parses all the files to ensure they are valid without running them.", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(validateCmd).Standalone() + rootCmd.AddCommand(validateCmd) + + carapace.Gen(validateCmd).PositionalAnyCompletion( + carapace.ActionFiles(".tape"), + ) +} diff --git a/completers/vhs_completer/main.go b/completers/vhs_completer/main.go new file mode 100644 index 0000000000..fb241ac3e4 --- /dev/null +++ b/completers/vhs_completer/main.go @@ -0,0 +1,7 @@ +package main + +import "github.com/rsteube/carapace-bin/completers/vhs_completer/cmd" + +func main() { + cmd.Execute() +}