completion

package
v0.0.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2018 License: Apache-2.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppCompletionHandler = func(cmd *cobra.Command, args complete.Args, 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

View Source
var FileCompletionHandler = func(cmd *cobra.Command, args complete.Args, context *genericclioptions.Context) (completions []string) {
	completions = append(completions, complete.PredictFiles("*").Predict(args)...)
	return
}

FileCompletionHandler provides suggestions for files and directories

View Source
var ServiceClassCompletionHandler = func(cmd *cobra.Command, args complete.Args, 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

View Source
var ServiceCompletionHandler = func(cmd *cobra.Command, args complete.Args, 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

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

func GetCommandHandler(command *cobra.Command) (predictor complete.Predictor, ok bool)

GetCommandHandler retrieves the command handler associated with the specified command or nil otherwise

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 complete.Args, 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL