Documentation
¶
Overview ¶
Copyright © 2024 Pone Ding <[email protected]>
Copyright © 2024 Pone Ding <[email protected]>
Copyright © 2024 Pone Ding <[email protected]>
Index ¶
- Constants
- func AddServer(server *Server)
- func Comfirm(label string) bool
- func ConfigFile() string
- func Connect(server *Server)
- func RemoveServer(server *Server)
- func SaveConfigurationFile()
- func TryCreateConfigurationFile()
- func UpdateServer(name string, newServer *Server)
- type Options
- type Server
- func AddFormPrompt() *Server
- func EditFormPrompt(server *Server) *Server
- func FormPrompt(server *Server) *Server
- func GetCurrentServer() *Server
- func GetServer(name string) *Server
- func GetServers() []*Server
- func NewServer(name, host string, options ...Options) *Server
- func SelectPrompt(label string) (selected *Server)
Constants ¶
View Source
const ( ConnectPromptLable = "Select a server to connect" RemovePromptLable = "Select a server to remove" EditPromptLable = "Select a server to edit" )
View Source
const ( AddServerPromptOperation = "Add a new server" ExitPromptOperation = "Exit" )
Variables ¶
This section is empty.
Functions ¶
func ConfigFile ¶ added in v1.1.0
func ConfigFile() string
func RemoveServer ¶ added in v1.1.0
func RemoveServer(server *Server)
RemoveServer removes a server by name
func SaveConfigurationFile ¶ added in v1.1.0
func SaveConfigurationFile()
SaveConfigurationFile save the servers to the configuration file
func TryCreateConfigurationFile ¶ added in v1.1.0
func TryCreateConfigurationFile()
TryCreateConfigurationFile creates server file
func UpdateServer ¶ added in v1.1.0
UpdateServer update a server by name
Types ¶
type Options ¶
type Options func(*Server)
func WithIdentityFile ¶ added in v1.1.0
func WithPassword ¶
type Server ¶ added in v1.1.0
type Server struct { Name string `yaml:"name"` Host string `yaml:"host"` Port int `yaml:"port"` User string `yaml:"user"` Password string `yaml:"password,omitempty"` IdentityFile string `yaml:"identity_file,omitempty"` Current bool `yaml:"current,omitempty"` Emoji string `yaml:"-"` }
func AddFormPrompt ¶ added in v1.1.0
func AddFormPrompt() *Server
AddFormPrompt prompts the user to fill in the server fields, and returns the new server.
func EditFormPrompt ¶ added in v1.1.0
EditFormPrompt prompts the user to modify the server fields, and returns the new server.
func FormPrompt ¶
func GetCurrentServer ¶ added in v1.1.0
func GetCurrentServer() *Server
GetCurrentServer returns the current server
func SelectPrompt ¶
SelectPrompt prompts the user to select a server, and returns the selected server.
Click to show internal directories.
Click to hide internal directories.