selector

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package selector provides functionality for users to select an application, environment, or service name.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigSelect

type ConfigSelect struct {
	*Select
	// contains filtered or unexported fields
}

ConfigSelect is an application and environment selector, but can also choose a service from the config store.

func NewConfigSelect

func NewConfigSelect(prompt Prompter, store *config.Store) *ConfigSelect

NewConfigSelect returns a new selector that chooses applications, environments, or services from the config store.

func (*ConfigSelect) Service

func (s *ConfigSelect) Service(prompt, help, app string) (string, error)

Service fetches all services in an app and prompts the user to select one.

type Prompter

type Prompter interface {
	SelectOne(message, help string, options []string, promptOpts ...prompt.Option) (string, error)
}

Prompter wraps the method for users to select an option from a list of options.

type Select

type Select struct {
	// contains filtered or unexported fields
}

Select prompts users to select the name of an application or environment.

func NewSelect

func NewSelect(prompt Prompter, store *config.Store) *Select

NewSelect returns a selector that chooses applications or environments.

func (*Select) Application

func (s *Select) Application(prompt, help string) (string, error)

Application fetches all the apps in an account/region and prompts the user to select one.

func (*Select) Environment

func (s *Select) Environment(prompt, help, app string) (string, error)

Environment fetches all the environments in an app and prompts the user to select one.

func (*Select) EnvironmentWithNone

func (s *Select) EnvironmentWithNone(prompt, help, app string) (string, error)

EnvironmentWithNone fetches all the environments in an app and prompts the user to select one of the environments or None.

type WorkspaceSelect

type WorkspaceSelect struct {
	*Select
	// contains filtered or unexported fields
}

WorkspaceSelect is an application and environment selector, but can also choose a service from the workspace.

func NewWorkspaceSelect

func NewWorkspaceSelect(prompt Prompter, store *config.Store, ws *workspace.Workspace) *WorkspaceSelect

NewWorkspaceSelect returns a new selector that chooses applications and environments from the config store, but services from the local workspace.

func (*WorkspaceSelect) Service

func (s *WorkspaceSelect) Service(prompt, help string) (string, error)

Service fetches all services in the workspace and then prompts the user to select one.

Jump to

Keyboard shortcuts

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