Documentation
¶
Index ¶
Constants ¶
View Source
const CALLBACK_ANNOTATION = "cobra-prompt"
CALLBACK_ANNOTATION
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CobraPrompt ¶
type CobraPrompt struct { // RootCmd is the start point, all its sub commands and flags will be available as suggestions RootCmd *cobra.Command // GoPromptOptions is for customize go-prompt // see https://github.com/c-bata/go-prompt/blob/master/option.go GoPromptOptions []prompt.Option // DynamicSuggestionsFunc will be executed if an command has CALLBACK_ANNOTATION as an annotation. If it's included // the value will be provided to the DynamicSuggestionsFunc function. DynamicSuggestionsFunc func(annotation string, document prompt.Document) []prompt.Suggest // ResetFlagsFlag will add a new persistent flag to RootCmd. This flags can be used to turn off flags value reset ResetFlagsFlag bool }
CobraPrompt requires RootCmd to run
func (CobraPrompt) Run ¶
func (co CobraPrompt) Run()
Run will automatically generate suggestions for all cobra commands and flags defined by RootCmd and execute the selected commands. Run will also reset all given flags by default, see ResetFlagsFlag
Click to show internal directories.
Click to hide internal directories.