completion

package
v2.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchStringPrefix

func MatchStringPrefix(vals []string, key string, caseSensitive bool) []string

MatchStringPrefix returns a list of string in vals which have a prefix as specified in key. Quotes are removed from key and output strings are escaped according to completion rules

func None

None is a fallback with no completion, for error cases etc.

func RemoveWordBreaks added in v2.5.0

func RemoveWordBreaks(input string) string

RemoveWordBreaks replaces all whitespaces in input strings with non-breaking spaces to prevent bash from splitting completion with whitespace into multiple completions.

This hack allows us to use cobras built-in completion logic and can be removed once cobra supports whitespace in bash completions (See https://github.com/spf13/cobra/issues/1740).

Types

type Database

type Database struct{}

Database implements argument completion for databases, by uuid or title.

func (Database) CompleteArgument

func (s Database) CompleteArgument(ctx context.Context, svc service.AllServices, toComplete string) ([]string, cobra.ShellCompDirective)

CompleteArgument implements completion.Provider

type DatabaseProperty added in v2.5.0

type DatabaseProperty struct {
	ServiceType string
}

DatabaseProperty implements argument completion for database properties.

func (DatabaseProperty) CompleteArgument added in v2.5.0

func (s DatabaseProperty) CompleteArgument(ctx context.Context, svc service.AllServices, toComplete string) ([]string, cobra.ShellCompDirective)

CompleteArgument implements completion.Provider

type DatabaseType

type DatabaseType struct{}

DatabaseType implements argument completion for database types.

func (DatabaseType) CompleteArgument

func (s DatabaseType) CompleteArgument(ctx context.Context, svc service.AllServices, toComplete string) ([]string, cobra.ShellCompDirective)

CompleteArgument implements completion.Provider

type IPAddress

type IPAddress struct{}

IPAddress implements argument completion for ip addresses, by ptr record or the adddress itself

func (IPAddress) CompleteArgument

func (s IPAddress) CompleteArgument(ctx context.Context, svc service.AllServices, toComplete string) ([]string, cobra.ShellCompDirective)

CompleteArgument implements completion.Provider

type Kubernetes added in v2.4.0

type Kubernetes struct{}

Kubernetes implements argument completion for Kubernetes clusters, by uuid or name.

func (Kubernetes) CompleteArgument added in v2.4.0

func (s Kubernetes) CompleteArgument(ctx context.Context, svc service.AllServices, toComplete string) ([]string, cobra.ShellCompDirective)

CompleteArgument implements completion.Provider

type LoadBalancer

type LoadBalancer struct{}

LoadBalancer implements argument completion for load balancers, by uuid or name.

func (LoadBalancer) CompleteArgument

func (s LoadBalancer) CompleteArgument(ctx context.Context, svc service.AllServices, toComplete string) ([]string, cobra.ShellCompDirective)

CompleteArgument implements completion.Provider

type Network

type Network struct{}

Network implements argument completion for networks, by name or uuid.

func (Network) CompleteArgument

func (s Network) CompleteArgument(ctx context.Context, svc service.AllServices, toComplete string) ([]string, cobra.ShellCompDirective)

CompleteArgument implements completion.Provider

type Provider

type Provider interface {
	CompleteArgument(ctx context.Context, svc service.AllServices, toComplete string) ([]string, cobra.ShellCompDirective)
}

Provider should be implemented by a command that can provide argument completion

type Router

type Router struct{}

Router implements argument completion for routers, by name or uuid.

func (Router) CompleteArgument

func (s Router) CompleteArgument(ctx context.Context, svc service.AllServices, toComplete string) ([]string, cobra.ShellCompDirective)

CompleteArgument implements completion.Provider

type Server

type Server struct{}

Server implements argument completion for servers, by uuid, name or hostname.

func (Server) CompleteArgument

func (s Server) CompleteArgument(ctx context.Context, svc service.AllServices, toComplete string) ([]string, cobra.ShellCompDirective)

CompleteArgument implements completion.Provider

type ServerGroup added in v2.9.0

type ServerGroup struct{}

ServerGroup implements argument completion for server groups, by uuid or title.

func (ServerGroup) CompleteArgument added in v2.9.0

func (s ServerGroup) CompleteArgument(ctx context.Context, svc service.AllServices, toComplete string) ([]string, cobra.ShellCompDirective)

CompleteArgument implements completion.Provider

type Storage

type Storage struct{}

Storage implements argument completion for routers, by uuid, name or hostname.

func (Storage) CompleteArgument

func (s Storage) CompleteArgument(ctx context.Context, svc service.AllServices, toComplete string) ([]string, cobra.ShellCompDirective)

CompleteArgument implements completion.Provider

type Zone added in v2.8.0

type Zone struct{}

Zone implements argument completion for zones by id.

func (Zone) CompleteArgument added in v2.8.0

func (s Zone) CompleteArgument(ctx context.Context, svc service.AllServices, toComplete string) ([]string, cobra.ShellCompDirective)

CompleteArgument implements completion.Provider

Jump to

Keyboard shortcuts

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