Leverages the Cobra completion API to generate an interactive shell for any Cobra CLI, powered by go-prompt.
- On-the-fly autocompletion for all commands
- Static and dynamic autocompletion for args and flags, as described here
- Full prompt customizability
go get github.com/brianstrauch/cobra-shell
package main
import (
shell "github.com/brianstrauch/cobra-shell"
"github.com/spf13/cobra"
)
func main() {
cmd := &cobra.Command{Use: "example"}
cmd.AddCommand(shell.New())
_ = cmd.Execute()
}