Rich Enhanced Shell History - Contextual shell history for zsh and bash
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
resh/cmd/control/cmd/completion.go

48 lines
987 B

package cmd
import (
"os"
"github.com/curusarn/resh/cmd/control/status"
"github.com/spf13/cobra"
)
// completionCmd represents the completion command
var completionCmd = &cobra.Command{
Use: "completion",
Short: "generate bash/zsh completion scripts",
Long: `To load completion run
. <(reshctl completion bash)
OR
. <(reshctl completion zsh) && compdef _reshctl reshctl
`,
}
var completionBashCmd = &cobra.Command{
Use: "bash",
Short: "generate bash completion scripts",
Long: `To load completion run
. <(reshctl completion bash)
`,
Run: func(cmd *cobra.Command, args []string) {
rootCmd.GenBashCompletion(os.Stdout)
exitCode = status.Success
},
}
var completionZshCmd = &cobra.Command{
Use: "zsh",
Short: "generate zsh completion scripts",
Long: `To load completion run
. <(reshctl completion zsh) && compdef _reshctl reshctl
`,
Run: func(cmd *cobra.Command, args []string) {
rootCmd.GenZshCompletion(os.Stdout)
exitCode = status.Success
},
}