...

Source file src/github.com/redhat-developer/odo/pkg/init/asker/interface.go

Documentation: github.com/redhat-developer/odo/pkg/init/asker

     1  // package asker uses the Survey library to interact with the user and ask various information
     2  // needed to initiate a project.
     3  package asker
     4  
     5  import (
     6  	"github.com/redhat-developer/odo/pkg/api"
     7  	"github.com/redhat-developer/odo/pkg/registry"
     8  )
     9  
    10  // Asker interactively asks for information to the user
    11  type Asker interface {
    12  	// AskArchitectures asks for a selection of architectures from a list of architecture names
    13  	AskArchitectures(archs []string, selectedDefault []string) ([]string, error)
    14  
    15  	// AskLanguage asks for a language, from a list of language names.
    16  	// back is returned as true if the user selected to go back, or the language name is returned
    17  	AskLanguage(langs []string) (back bool, result string, err error)
    18  
    19  	// AskType asks for a Devfile type, or to go back. back is returned as true if the user selected to go back,
    20  	// or the selected type is returned
    21  	AskType(types registry.TypesWithDetails) (back bool, _ api.DevfileStack, _ error)
    22  
    23  	// AskVersion asks for the Devfile version, or to go back. back is returned as true if the user selected to go back,
    24  	// or the selected version is returned
    25  	AskVersion(versions []api.DevfileStackVersion) (back bool, version string, _ error)
    26  
    27  	// AskStarterProject asks for an optional project, from a list of projects. If no project is selected, false is returned.
    28  	// Or the index of the selected project is returned
    29  	AskStarterProject(projects []string) (selected bool, _ int, _ error)
    30  
    31  	// AskName asks for a devfile component name
    32  	AskName(defaultName string) (string, error)
    33  
    34  	// AskCorrect asks for confirmation
    35  	AskCorrect() (bool, error)
    36  
    37  	AskContainerName(containers []string) (string, error)
    38  
    39  	// AskPersonalizeConfiguration asks the configuration user wants to change
    40  	AskPersonalizeConfiguration(configuration ContainerConfiguration) (OperationOnContainer, error)
    41  
    42  	// AskAddEnvVar asks the key and value for env var
    43  	AskAddEnvVar() (string, string, error)
    44  
    45  	// AskAddPort asks the container name and port that user wants to add
    46  	AskAddPort() (string, error)
    47  }
    48  
    49  type ContainerConfiguration struct {
    50  	Ports []string
    51  	Envs  map[string]string
    52  }
    53  
    54  type OperationOnContainer struct {
    55  	Ops  string
    56  	Kind string
    57  	Key  string
    58  }
    59  
    60  // key is container name
    61  type DevfileConfiguration map[string]ContainerConfiguration
    62  

View as plain text