Documentation ¶
Index ¶
- Variables
- func GetCommandFlagHandler(command *cobra.Command, flag string) (predictor complete.Predictor, ok bool)
- func GetCommandHandler(command *cobra.Command) (predictor complete.Predictor, ok bool)
- func NewParsedArgs(args complete.Args, cmd *cobra.Command) parsedArgs
- func RegisterCommandFlagHandler(command *cobra.Command, flag string, predictor ContextualizedPredictor)
- func RegisterCommandHandler(command *cobra.Command, predictor ContextualizedPredictor)
- type ContextualizedPredictor
Constants ¶
This section is empty.
Variables ¶
var AppCompletionHandler = func(cmd *cobra.Command, args parsedArgs, context *genericclioptions.Context) (completions []string) { completions = make([]string, 0) applications, err := application.List(context.Client) if err != nil { return completions } for _, app := range applications { completions = append(completions, app.Name) } return }
AppCompletionHandler provides completion for the app commands
var FileCompletionHandler = func(cmd *cobra.Command, args parsedArgs, context *genericclioptions.Context) (completions []string) { completions = append(completions, complete.PredictFiles("*").Predict(args.original)...) return }
FileCompletionHandler provides suggestions for files and directories
var ProjectNameCompletionHandler = func(cmd *cobra.Command, args parsedArgs, context *genericclioptions.Context) (completions []string) { completions = make([]string, 0) projects, err := project.List(context.Client) if err != nil { return completions } for _, project := range projects { if val, ok := args.commands[project.Name]; ok && val { return nil } completions = append(completions, project.Name) } return completions }
ProjectNameCompletionHandler provides project name completion
var ServiceClassCompletionHandler = func(cmd *cobra.Command, args parsedArgs, context *genericclioptions.Context) (completions []string) { completions = make([]string, 0) services, err := context.Client.GetClusterServiceClasses() if err != nil { return completions } for _, class := range services { completions = append(completions, class.Spec.ExternalName) } return }
ServiceClassCompletionHandler provides catalog service class name completion
var ServiceCompletionHandler = func(cmd *cobra.Command, args parsedArgs, context *genericclioptions.Context) (completions []string) { completions = make([]string, 0) services, err := service.List(context.Client, context.Application) if err != nil { return completions } for _, class := range services { completions = append(completions, class.Name) } return }
ServiceCompletionHandler provides service name completion for the current project and application
var URLCompletionHandler = func(cmd *cobra.Command, args parsedArgs, context *genericclioptions.Context) (completions []string) { completions = make([]string, 0) urls, err := url.List(context.Client, context.Component(), context.Application) if err != nil { return completions } for _, url := range urls { if val, ok := args.commands[url.Name]; ok && val { return nil } completions = append(completions, url.Name) } return }
URLCompletionHandler provides completion for the url commands
Functions ¶
func GetCommandFlagHandler ¶
func GetCommandFlagHandler(command *cobra.Command, flag string) (predictor complete.Predictor, ok bool)
GetCommandFlagHandler retrieves the command handler associated with the specified flag of the specified command or nil otherwise
func GetCommandHandler ¶
GetCommandHandler retrieves the command handler associated with the specified command or nil otherwise
func NewParsedArgs ¶ added in v0.0.16
NewParsedArgs creates a parsed representation of the provided arguments for the specified command. Mostly exposed for tests.
func RegisterCommandFlagHandler ¶
func RegisterCommandFlagHandler(command *cobra.Command, flag string, predictor ContextualizedPredictor)
RegisterCommandFlagHandler registers the provided ContextualizedPredictor as a completion handler for the specified flag of the specified command
func RegisterCommandHandler ¶
func RegisterCommandHandler(command *cobra.Command, predictor ContextualizedPredictor)
RegisterCommandHandler registers the provided ContextualizedPredictor as a completion handler for the specified command
Types ¶
type ContextualizedPredictor ¶
type ContextualizedPredictor func(cmd *cobra.Command, args parsedArgs, context *genericclioptions.Context) []string
ContextualizedPredictor predicts completion based on specified arguments, potentially using the context provided by the specified client to resolve the entities to be completed