Skip to content

Commit

Permalink
Merge pull request #2077 from rsteube/vhs-updates-0.7.1
Browse files Browse the repository at this point in the history
vhs: updates from 0.7.1
  • Loading branch information
rsteube authored Dec 18, 2023
2 parents 73595b8 + db41f07 commit 12713b8
Show file tree
Hide file tree
Showing 14 changed files with 200 additions and 11 deletions.
19 changes: 19 additions & 0 deletions completers/vhs_completer/cmd/completion.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var completionCmd = &cobra.Command{
Use: "completion",
Short: "Generate the autocompletion script for the specified shell",
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(completionCmd).Standalone()

rootCmd.AddCommand(completionCmd)
}
19 changes: 19 additions & 0 deletions completers/vhs_completer/cmd/completion_bash.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var completion_bashCmd = &cobra.Command{
Use: "bash",
Short: "Generate the autocompletion script for bash",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(completion_bashCmd).Standalone()

completion_bashCmd.Flags().Bool("no-descriptions", false, "disable completion descriptions")
completionCmd.AddCommand(completion_bashCmd)
}
19 changes: 19 additions & 0 deletions completers/vhs_completer/cmd/completion_fish.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var completion_fishCmd = &cobra.Command{
Use: "fish",
Short: "Generate the autocompletion script for fish",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(completion_fishCmd).Standalone()

completion_fishCmd.Flags().Bool("no-descriptions", false, "disable completion descriptions")
completionCmd.AddCommand(completion_fishCmd)
}
19 changes: 19 additions & 0 deletions completers/vhs_completer/cmd/completion_powershell.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var completion_powershellCmd = &cobra.Command{
Use: "powershell",
Short: "Generate the autocompletion script for powershell",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(completion_powershellCmd).Standalone()

completion_powershellCmd.Flags().Bool("no-descriptions", false, "disable completion descriptions")
completionCmd.AddCommand(completion_powershellCmd)
}
19 changes: 19 additions & 0 deletions completers/vhs_completer/cmd/completion_zsh.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var completion_zshCmd = &cobra.Command{
Use: "zsh",
Short: "Generate the autocompletion script for zsh",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(completion_zshCmd).Standalone()

completion_zshCmd.Flags().Bool("no-descriptions", false, "disable completion descriptions")
completionCmd.AddCommand(completion_zshCmd)
}
7 changes: 6 additions & 1 deletion completers/vhs_completer/cmd/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ import (
)

var helpCmd = &cobra.Command{
Use: "help",
Use: "help [command]",
Short: "Help about any command",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(helpCmd).Standalone()

rootCmd.AddCommand(helpCmd)

carapace.Gen(helpCmd).PositionalAnyCompletion(
carapace.ActionCommands(rootCmd),
)
}
20 changes: 20 additions & 0 deletions completers/vhs_completer/cmd/manual.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var manualCmd = &cobra.Command{
Use: "manual",
Short: "Generate man pages",
Aliases: []string{"man"},
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(manualCmd).Standalone()

rootCmd.AddCommand(manualCmd)
}
3 changes: 2 additions & 1 deletion completers/vhs_completer/cmd/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import (
)

var newCmd = &cobra.Command{
Use: "new",
Use: "new <name>",
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(
Expand Down
22 changes: 22 additions & 0 deletions completers/vhs_completer/cmd/publish.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var publishCmd = &cobra.Command{
Use: "publish <gif>",
Short: "Publish your GIF to vhs.charm.sh and get a shareable URL",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(publishCmd).Standalone()

rootCmd.AddCommand(publishCmd)

carapace.Gen(publishCmd).PositionalCompletion(
carapace.ActionFiles(),
)
}
24 changes: 24 additions & 0 deletions completers/vhs_completer/cmd/record.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/rsteube/carapace-bin/pkg/actions/os"
"github.com/spf13/cobra"
)

var recordCmd = &cobra.Command{
Use: "record",
Short: "Create a new tape file by recording your actions",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(recordCmd).Standalone()

recordCmd.Flags().StringP("shell", "s", "", "shell for recording")
rootCmd.AddCommand(recordCmd)

carapace.Gen(recordCmd).FlagCompletion(carapace.ActionMap{
"shell": os.ActionShells(),
})
}
9 changes: 8 additions & 1 deletion completers/vhs_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

var rootCmd = &cobra.Command{
Use: "vhs",
Use: "vhs <file>",
Short: "Run a given tape file and generates its outputs.",
Long: "https://github.com/charmbracelet/vhs",
Run: func(cmd *cobra.Command, args []string) {},
Expand All @@ -19,7 +19,14 @@ func Execute() error {
func init() {
carapace.Gen(rootCmd).Standalone()
rootCmd.Flags().BoolP("help", "h", false, "help for vhs")
rootCmd.Flags().StringSliceP("output", "o", []string{}, "file name(s) of video output")
rootCmd.Flags().BoolP("publish", "p", false, "publish your GIF to vhs.charm.sh and get a shareable URL")
rootCmd.Flags().BoolP("version", "v", false, "version for vhs")
rootCmd.PersistentFlags().BoolP("quiet", "q", false, "quiet do not log messages. If publish flag is provided, it will log shareable URL")

carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
"output": carapace.ActionFiles(),
})

carapace.Gen(rootCmd).PositionalCompletion(
carapace.ActionFiles(".tape"),
Expand Down
8 changes: 1 addition & 7 deletions completers/vhs_completer/cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cmd

import (
"github.com/rsteube/carapace"
"github.com/rsteube/carapace-bin/pkg/actions/net"
"github.com/spf13/cobra"
)

Expand All @@ -14,11 +13,6 @@ var serveCmd = &cobra.Command{

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(),
})
rootCmd.AddCommand(serveCmd)
}
20 changes: 20 additions & 0 deletions completers/vhs_completer/cmd/themes.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var themesCmd = &cobra.Command{
Use: "themes",
Short: "List all the available themes, one per line",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(themesCmd).Standalone()

themesCmd.Flags().Bool("markdown", false, "output as markdown")
themesCmd.Flag("markdown").Hidden = true
rootCmd.AddCommand(themesCmd)
}
3 changes: 2 additions & 1 deletion completers/vhs_completer/cmd/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import (
)

var validateCmd = &cobra.Command{
Use: "validate",
Use: "validate <file>...",
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(
Expand Down

0 comments on commit 12713b8

Please sign in to comment.