Documentation ¶
Index ¶
- Constants
- func BestEffortFilter(args []string, suggestions map[string][]prompt.Suggest) []prompt.Suggest
- func LengthFilter(args []string, suggestions map[string][]prompt.Suggest) []prompt.Suggest
- func RegisterSharedProvider(id string, provider Provider)
- type Completer
- type GenericCompleter
- type Provider
- type Repository
- type SuggestionFilter
Constants ¶
const ( Path = "path" Output = "output" Loglevel = "Loglevel" )
const ( Option = "option" Argument = "argument" )
Variables ¶
This section is empty.
Functions ¶
func BestEffortFilter ¶
The BestEffortFilter is to find mostly match suggestion, common use for Options eg: input: istio admin log <POD_NAME> <POD_NAME2> --Options "istio admin log"'s option is better than "istio admin"
func LengthFilter ¶
The LengthFilter must make sure the each Arguments is in the right place, common use for Arguments eg: input: istio admin log <sth> only "istio admin log <sth>" will match
func RegisterSharedProvider ¶
Types ¶
type Completer ¶
type Completer interface {
Complete(doc prompt.Document) []prompt.Suggest
}
The Completer interface is a collection of functions for the user to perform intelligent completion when entering the command line
type GenericCompleter ¶
type GenericCompleter struct { Completer SuggestionProviders Repository Arguments []prompt.Suggest Options []prompt.Suggest Setup func(*GenericCompleter) }
The GenericCompleter is not related to specific environmental Completer generalization achieved. When designing a Completer of a specific environment, general capabilities can be obtained by inheriting GenericCompleter.
func NewGenericCompleter ¶
func NewGenericCompleter(arguments []prompt.Suggest, options []prompt.Suggest, setup func(*GenericCompleter)) *GenericCompleter
Construct a GenericCompleter instance
func (GenericCompleter) Complete ¶
func (g GenericCompleter) Complete(doc prompt.Document) []prompt.Suggest
According to the user input information, give intelligent completion
type Provider ¶
type Provider func(...string) []prompt.Suggest
The Provider is data source for different types of Suggestions
func BuildFixedSelectionProvider ¶
Build fixed selection (eg: json|yaml|xml) Provider
func BuildStaticCompletionProvider ¶
func BuildStaticCompletionProvider(options []prompt.Suggest, fn SuggestionFilter) Provider
Build static completion (Arguments \ Options) Provider
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
The Repository is a set of Provider
func (*Repository) Add ¶
func (r *Repository) Add(id string, provider Provider)
Adding a Provider to Repository
func (*Repository) Provide ¶
func (r *Repository) Provide(id string, args ...string) []prompt.Suggest
Providing suggestion by a specified Provider
type SuggestionFilter ¶
The SuggestionFilter determines how to map user input information to Suggestion