...

Package asker

Overview ▾

package asker uses the Survey library to interact with the user and ask various information needed to initiate a project.

Package asker is a generated GoMock package.

Index ▾

Constants
type Asker
type ContainerConfiguration
type DevfileConfiguration
    func (dc *DevfileConfiguration) GetContainers() []string
type MockAsker
    func NewMockAsker(ctrl *gomock.Controller) *MockAsker
    func (m *MockAsker) AskAddEnvVar() (string, string, error)
    func (m *MockAsker) AskAddPort() (string, error)
    func (m *MockAsker) AskArchitectures(archs, selectedDefault []string) ([]string, error)
    func (m *MockAsker) AskContainerName(containers []string) (string, error)
    func (m *MockAsker) AskCorrect() (bool, error)
    func (m *MockAsker) AskLanguage(langs []string) (bool, string, error)
    func (m *MockAsker) AskName(defaultName string) (string, error)
    func (m *MockAsker) AskPersonalizeConfiguration(configuration ContainerConfiguration) (OperationOnContainer, error)
    func (m *MockAsker) AskStarterProject(projects []string) (bool, int, error)
    func (m *MockAsker) AskType(types registry.TypesWithDetails) (bool, api.DevfileStack, error)
    func (m *MockAsker) AskVersion(versions []api.DevfileStackVersion) (bool, string, error)
    func (m *MockAsker) EXPECT() *MockAskerMockRecorder
type MockAskerMockRecorder
    func (mr *MockAskerMockRecorder) AskAddEnvVar() *gomock.Call
    func (mr *MockAskerMockRecorder) AskAddPort() *gomock.Call
    func (mr *MockAskerMockRecorder) AskArchitectures(archs, selectedDefault interface{}) *gomock.Call
    func (mr *MockAskerMockRecorder) AskContainerName(containers interface{}) *gomock.Call
    func (mr *MockAskerMockRecorder) AskCorrect() *gomock.Call
    func (mr *MockAskerMockRecorder) AskLanguage(langs interface{}) *gomock.Call
    func (mr *MockAskerMockRecorder) AskName(defaultName interface{}) *gomock.Call
    func (mr *MockAskerMockRecorder) AskPersonalizeConfiguration(configuration interface{}) *gomock.Call
    func (mr *MockAskerMockRecorder) AskStarterProject(projects interface{}) *gomock.Call
    func (mr *MockAskerMockRecorder) AskType(types interface{}) *gomock.Call
    func (mr *MockAskerMockRecorder) AskVersion(versions interface{}) *gomock.Call
type OperationOnContainer
type Survey
    func NewSurveyAsker() *Survey
    func (o *Survey) AskAddEnvVar() (string, string, error)
    func (o *Survey) AskAddPort() (string, error)
    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)
    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)

Package files

asker.go interface.go mock.go

Constants

const (
    GOBACK = "** GO BACK **"
)

type Asker

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

type ContainerConfiguration struct {
    Ports []string
    Envs  map[string]string
}

type DevfileConfiguration

key is container name

type DevfileConfiguration map[string]ContainerConfiguration

func (*DevfileConfiguration) GetContainers

func (dc *DevfileConfiguration) GetContainers() []string

type MockAsker

MockAsker is a mock of Asker interface.

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

func NewMockAsker

func NewMockAsker(ctrl *gomock.Controller) *MockAsker

NewMockAsker creates a new mock instance.

func (*MockAsker) AskAddEnvVar

func (m *MockAsker) AskAddEnvVar() (string, string, error)

AskAddEnvVar mocks base method.

func (*MockAsker) AskAddPort

func (m *MockAsker) AskAddPort() (string, error)

AskAddPort mocks base method.

func (*MockAsker) AskArchitectures

func (m *MockAsker) AskArchitectures(archs, selectedDefault []string) ([]string, error)

AskArchitectures mocks base method.

func (*MockAsker) AskContainerName

func (m *MockAsker) AskContainerName(containers []string) (string, error)

AskContainerName mocks base method.

func (*MockAsker) AskCorrect

func (m *MockAsker) AskCorrect() (bool, error)

AskCorrect mocks base method.

func (*MockAsker) AskLanguage

func (m *MockAsker) AskLanguage(langs []string) (bool, string, error)

AskLanguage mocks base method.

func (*MockAsker) AskName

func (m *MockAsker) AskName(defaultName string) (string, error)

AskName mocks base method.

func (*MockAsker) AskPersonalizeConfiguration

func (m *MockAsker) AskPersonalizeConfiguration(configuration ContainerConfiguration) (OperationOnContainer, error)

AskPersonalizeConfiguration mocks base method.

func (*MockAsker) AskStarterProject

func (m *MockAsker) AskStarterProject(projects []string) (bool, int, error)

AskStarterProject mocks base method.

func (*MockAsker) AskType

func (m *MockAsker) AskType(types registry.TypesWithDetails) (bool, api.DevfileStack, error)

AskType mocks base method.

func (*MockAsker) AskVersion

func (m *MockAsker) AskVersion(versions []api.DevfileStackVersion) (bool, string, error)

AskVersion mocks base method.

func (*MockAsker) EXPECT

func (m *MockAsker) EXPECT() *MockAskerMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

type MockAskerMockRecorder

MockAskerMockRecorder is the mock recorder for MockAsker.

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

func (*MockAskerMockRecorder) AskAddEnvVar

func (mr *MockAskerMockRecorder) AskAddEnvVar() *gomock.Call

AskAddEnvVar indicates an expected call of AskAddEnvVar.

func (*MockAskerMockRecorder) AskAddPort

func (mr *MockAskerMockRecorder) AskAddPort() *gomock.Call

AskAddPort indicates an expected call of AskAddPort.

func (*MockAskerMockRecorder) AskArchitectures

func (mr *MockAskerMockRecorder) AskArchitectures(archs, selectedDefault interface{}) *gomock.Call

AskArchitectures indicates an expected call of AskArchitectures.

func (*MockAskerMockRecorder) AskContainerName

func (mr *MockAskerMockRecorder) AskContainerName(containers interface{}) *gomock.Call

AskContainerName indicates an expected call of AskContainerName.

func (*MockAskerMockRecorder) AskCorrect

func (mr *MockAskerMockRecorder) AskCorrect() *gomock.Call

AskCorrect indicates an expected call of AskCorrect.

func (*MockAskerMockRecorder) AskLanguage

func (mr *MockAskerMockRecorder) AskLanguage(langs interface{}) *gomock.Call

AskLanguage indicates an expected call of AskLanguage.

func (*MockAskerMockRecorder) AskName

func (mr *MockAskerMockRecorder) AskName(defaultName interface{}) *gomock.Call

AskName indicates an expected call of AskName.

func (*MockAskerMockRecorder) AskPersonalizeConfiguration

func (mr *MockAskerMockRecorder) AskPersonalizeConfiguration(configuration interface{}) *gomock.Call

AskPersonalizeConfiguration indicates an expected call of AskPersonalizeConfiguration.

func (*MockAskerMockRecorder) AskStarterProject

func (mr *MockAskerMockRecorder) AskStarterProject(projects interface{}) *gomock.Call

AskStarterProject indicates an expected call of AskStarterProject.

func (*MockAskerMockRecorder) AskType

func (mr *MockAskerMockRecorder) AskType(types interface{}) *gomock.Call

AskType indicates an expected call of AskType.

func (*MockAskerMockRecorder) AskVersion

func (mr *MockAskerMockRecorder) AskVersion(versions interface{}) *gomock.Call

AskVersion indicates an expected call of AskVersion.

type OperationOnContainer

type OperationOnContainer struct {
    Ops  string
    Kind string
    Key  string
}

type Survey

type Survey struct{}

func NewSurveyAsker

func NewSurveyAsker() *Survey

func (*Survey) AskAddEnvVar

func (o *Survey) AskAddEnvVar() (string, string, error)

AskAddEnvVar asks the key and value for env var

func (*Survey) AskAddPort

func (o *Survey) AskAddPort() (string, error)

AskAddPort asks the container name and port that user wants to add

func (*Survey) AskArchitectures

func (o *Survey) AskArchitectures(archs []string, selectedDefault []string) ([]string, error)

func (*Survey) AskContainerName

func (o *Survey) AskContainerName(containers []string) (string, error)

func (*Survey) AskCorrect

func (o *Survey) AskCorrect() (bool, error)

func (*Survey) AskLanguage

func (o *Survey) AskLanguage(langs []string) (bool, string, error)

func (*Survey) AskName

func (o *Survey) AskName(defaultName string) (string, error)

func (*Survey) AskPersonalizeConfiguration

func (o *Survey) AskPersonalizeConfiguration(configuration ContainerConfiguration) (OperationOnContainer, error)

AskPersonalizeConfiguration asks the configuration user wants to change

func (*Survey) AskStarterProject

func (o *Survey) AskStarterProject(projects []string) (bool, int, error)

func (*Survey) AskType

func (o *Survey) AskType(types registry.TypesWithDetails) (back bool, _ api.DevfileStack, _ error)

func (*Survey) AskVersion

func (o *Survey) AskVersion(versions []api.DevfileStackVersion) (back bool, version string, _ error)