completion

package
v3.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 9 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

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 Account added in v3.4.0

type Account struct{}

Account implements argument completion for accounts by username.

func (Account) CompleteArgument added in v3.4.0

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

CompleteArgument implements completion.Provider

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

type DatabaseProperty struct {
	ServiceType string
}

DatabaseProperty implements argument completion for database properties.

func (DatabaseProperty) CompleteArgument

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 Gateway added in v3.4.0

type Gateway struct{}

Gateway implements argument completion for gateways, by uuid or name.

func (Gateway) CompleteArgument added in v3.4.0

func (s Gateway) 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 address 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

type Kubernetes struct{}

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

func (Kubernetes) CompleteArgument

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

CompleteArgument implements completion.Provider

type KubernetesVersion added in v3.1.0

type KubernetesVersion struct{}

KubernetesVersion implements argument completion for Kubernetes versions by version id.

func (KubernetesVersion) CompleteArgument added in v3.1.0

func (s KubernetesVersion) 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 NetworkPeering added in v3.6.0

type NetworkPeering struct{}

NetworkPeering implements argument completion for network peerings, by uuid or name.

func (NetworkPeering) CompleteArgument added in v3.6.0

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

CompleteArgument implements completion.Provider

type ObjectStorage added in v3.7.0

type ObjectStorage struct{}

ObjectStorage implements argument completion for gateways, by uuid or name.

func (ObjectStorage) CompleteArgument added in v3.7.0

func (s ObjectStorage) 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

type ServerGroup struct{}

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

func (ServerGroup) CompleteArgument

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

CompleteArgument implements completion.Provider

type StartedServer added in v3.12.0

type StartedServer struct{}

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

func (StartedServer) CompleteArgument added in v3.12.0

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

CompleteArgument implements completion.Provider

type StoppedServer added in v3.12.0

type StoppedServer struct{}

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

func (StoppedServer) CompleteArgument added in v3.12.0

func (s StoppedServer) 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 Username added in v3.3.0

type Username struct{}

Username implements argument completion for zones by id.

func (Username) CompleteArgument added in v3.3.0

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

CompleteArgument implements completion.Provider

type Zone

type Zone struct{}

Zone implements argument completion for zones by id.

func (Zone) CompleteArgument

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