Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEmptyConfig = errors.New("Invalid config") ErrEmptyHost = errors.New("Can't be blank Host") ErrEmptyHostName = errors.New("Can't be blank HostName") ErrEmptyUser = errors.New("Can't be blank User") ErrEmptyIdentityFile = errors.New("Can't be blank IdentityFile") ErrEmptyPath = errors.New("Can't be blank config path") )
View Source
var ( MakeChoiceAddQuestion func() []*survey.Question = func() []*survey.Question { return []*survey.Question{ { Name: "", Prompt: &survey.Select{ Message: "select input format: ", Options: []string{ "0: input from ssh command (ex: ssh -i xxx.pem -p 22 ec2-user@xxx)", "1: input from interactive", }, }, Validate: survey.Required, }, } } MakeAddQuestionByCommandLine func() []*survey.Question = func() []*survey.Question { return []*survey.Question{ { Name: "Command", Prompt: &survey.Input{ Message: "Input ssh command: ", Help: "Available options are -p -i", }, Validate: sshValidator, }, { Name: "Host", Prompt: &survey.Input{ Message: "unique label as host: ", }, Validate: survey.Required, }, } } MakeAddQuestionByInteractive func() []*survey.Question = func() []*survey.Question { return []*survey.Question{ { Name: "HOST", Prompt: &survey.Input{ Message: "Enter Unique Name to represent specific endpoint:", }, Validate: survey.Required, }, { Name: "HostName", Prompt: &survey.Input{ Message: "Enter HostName that represents the connection destination:", Help: "Please type ip address for example 35.190.247.0", }, Validate: survey.Required, }, { Name: "User", Prompt: &survey.Input{ Message: "Enter user name: ", Default: "ec2-user", }, }, { Name: "IdentityFile", Prompt: &survey.Input{ Message: "Enter IdentityFile path: ", Help: "That is key file. ssh -i xxx. Commonly used extensions are pem or rsa. If you define $IDENTITY_KEY, use it as default value", Default: os.Getenv("IDENTITY_KEY"), }, Validate: survey.Required, }, { Name: "ProxyCommand", Prompt: &survey.Input{ Message: "Enter ProxyCommand: ", Help: "ex) ssh -W %h:%p test", }, }, } } MakeUpdateQuestion func(c *Config) []*survey.Question = func(c *Config) []*survey.Question { return []*survey.Question{ { Name: "HOST", Prompt: &survey.Input{ Message: "Enter Unique Name to represent specific endpoint:", Default: c.Host, }, Validate: survey.Required, }, { Name: "HostName", Prompt: &survey.Input{ Message: "Enter HostName that represents the connection destination:", Help: "Please type ip address for example 35.190.247.0", Default: c.HostName, }, Validate: survey.Required, }, { Name: "User", Prompt: &survey.Input{ Message: "Enter user name: ", Default: c.User, }, }, { Name: "IdentityFile", Prompt: &survey.Input{ Message: "Enter IdentityFile path: ", Help: "That is key file. ssh -i xxx. Commonly used extensions are pem or rsa. If you define $IDENTITY_KEY, use it as default value", Default: c.IdentityFile, }, Validate: survey.Required, }, } } )
View Source
var ( Stdout = colorable.NewColorableStdout() // add a colorable std out Stderr = colorable.NewColorableStderr() // add a colorable std err )
View Source
var InitData = `
HOST init
HostName 54.238.176.202
User ec2-user
identityFile /key.pem
`
View Source
var InitDataConfig = Config{ Host: InitDataMap[0]["HOST"], HostName: InitDataMap[0]["HostName"], User: InitDataMap[0]["User"], IdentityFile: InitDataMap[0]["identityFile"], ProxyCommand: InitDataMap[0]["ProxyCommand"], }
View Source
var InitDataMap = []map[string]string{
{
"HOST": "init",
"HostName": "54.238.176.202",
"User": "ec2-user",
"identityFile": "/key.pem",
},
}
Functions ¶
func CreateTestConfigFile ¶
func ShowMessage ¶
Types ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.