const (
GOBACK = "** GO BACK **"
)
Asker interactively asks for information to the user
type Asker interface { // AskArchitectures asks for a selection of architectures from a list of architecture names AskArchitectures(archs []string, selectedDefault []string) ([]string, error) // AskLanguage asks for a language, from a list of language names. // back is returned as true if the user selected to go back, or the language name is returned AskLanguage(langs []string) (back bool, result string, err error) // AskType asks for a Devfile type, or to go back. back is returned as true if the user selected to go back, // or the selected type is returned AskType(types registry.TypesWithDetails) (back bool, _ api.DevfileStack, _ error) // AskVersion asks for the Devfile version, or to go back. back is returned as true if the user selected to go back, // or the selected version is returned AskVersion(versions []api.DevfileStackVersion) (back bool, version string, _ error) // AskStarterProject asks for an optional project, from a list of projects. If no project is selected, false is returned. // Or the index of the selected project is returned AskStarterProject(projects []string) (selected bool, _ int, _ error) // AskName asks for a devfile component name AskName(defaultName string) (string, error) // AskCorrect asks for confirmation AskCorrect() (bool, error) AskContainerName(containers []string) (string, error) // AskPersonalizeConfiguration asks the configuration user wants to change AskPersonalizeConfiguration(configuration ContainerConfiguration) (OperationOnContainer, error) // AskAddEnvVar asks the key and value for env var AskAddEnvVar() (string, string, error) // AskAddPort asks the container name and port that user wants to add AskAddPort() (string, error) }
type ContainerConfiguration struct { Ports []string Envs map[string]string }
key is container name
type DevfileConfiguration map[string]ContainerConfiguration
func (dc *DevfileConfiguration) GetContainers() []string
MockAsker is a mock of Asker interface.
type MockAsker struct {
// contains filtered or unexported fields
}
func NewMockAsker(ctrl *gomock.Controller) *MockAsker
NewMockAsker creates a new mock instance.
func (m *MockAsker) AskAddEnvVar() (string, string, error)
AskAddEnvVar mocks base method.
func (m *MockAsker) AskAddPort() (string, error)
AskAddPort mocks base method.
func (m *MockAsker) AskArchitectures(archs, selectedDefault []string) ([]string, error)
AskArchitectures mocks base method.
func (m *MockAsker) AskContainerName(containers []string) (string, error)
AskContainerName mocks base method.
func (m *MockAsker) AskCorrect() (bool, error)
AskCorrect mocks base method.
func (m *MockAsker) AskLanguage(langs []string) (bool, string, error)
AskLanguage mocks base method.
func (m *MockAsker) AskName(defaultName string) (string, error)
AskName mocks base method.
func (m *MockAsker) AskPersonalizeConfiguration(configuration ContainerConfiguration) (OperationOnContainer, error)
AskPersonalizeConfiguration mocks base method.
func (m *MockAsker) AskStarterProject(projects []string) (bool, int, error)
AskStarterProject mocks base method.
func (m *MockAsker) AskType(types registry.TypesWithDetails) (bool, api.DevfileStack, error)
AskType mocks base method.
func (m *MockAsker) AskVersion(versions []api.DevfileStackVersion) (bool, string, error)
AskVersion mocks base method.
func (m *MockAsker) EXPECT() *MockAskerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
MockAskerMockRecorder is the mock recorder for MockAsker.
type MockAskerMockRecorder struct {
// contains filtered or unexported fields
}
func (mr *MockAskerMockRecorder) AskAddEnvVar() *gomock.Call
AskAddEnvVar indicates an expected call of AskAddEnvVar.
func (mr *MockAskerMockRecorder) AskAddPort() *gomock.Call
AskAddPort indicates an expected call of AskAddPort.
func (mr *MockAskerMockRecorder) AskArchitectures(archs, selectedDefault interface{}) *gomock.Call
AskArchitectures indicates an expected call of AskArchitectures.
func (mr *MockAskerMockRecorder) AskContainerName(containers interface{}) *gomock.Call
AskContainerName indicates an expected call of AskContainerName.
func (mr *MockAskerMockRecorder) AskCorrect() *gomock.Call
AskCorrect indicates an expected call of AskCorrect.
func (mr *MockAskerMockRecorder) AskLanguage(langs interface{}) *gomock.Call
AskLanguage indicates an expected call of AskLanguage.
func (mr *MockAskerMockRecorder) AskName(defaultName interface{}) *gomock.Call
AskName indicates an expected call of AskName.
func (mr *MockAskerMockRecorder) AskPersonalizeConfiguration(configuration interface{}) *gomock.Call
AskPersonalizeConfiguration indicates an expected call of AskPersonalizeConfiguration.
func (mr *MockAskerMockRecorder) AskStarterProject(projects interface{}) *gomock.Call
AskStarterProject indicates an expected call of AskStarterProject.
func (mr *MockAskerMockRecorder) AskType(types interface{}) *gomock.Call
AskType indicates an expected call of AskType.
func (mr *MockAskerMockRecorder) AskVersion(versions interface{}) *gomock.Call
AskVersion indicates an expected call of AskVersion.
type OperationOnContainer struct { Ops string Kind string Key string }
type Survey struct{}
func NewSurveyAsker() *Survey
func (o *Survey) AskAddEnvVar() (string, string, error)
AskAddEnvVar asks the key and value for env var
func (o *Survey) AskAddPort() (string, error)
AskAddPort asks the container name and port that user wants to add
func (o *Survey) AskArchitectures(archs []string, selectedDefault []string) ([]string, error)
func (o *Survey) AskContainerName(containers []string) (string, error)
func (o *Survey) AskCorrect() (bool, error)
func (o *Survey) AskLanguage(langs []string) (bool, string, error)
func (o *Survey) AskName(defaultName string) (string, error)
func (o *Survey) AskPersonalizeConfiguration(configuration ContainerConfiguration) (OperationOnContainer, error)
AskPersonalizeConfiguration asks the configuration user wants to change
func (o *Survey) AskStarterProject(projects []string) (bool, int, error)
func (o *Survey) AskType(types registry.TypesWithDetails) (back bool, _ api.DevfileStack, _ error)
func (o *Survey) AskVersion(versions []api.DevfileStackVersion) (back bool, version string, _ error)