ssh

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Copyright © 2024 Pone Ding <[email protected]>

Copyright © 2024 Pone Ding <[email protected]>

Copyright © 2024 Pone Ding <[email protected]>

Index

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 AddServer added in v1.1.0

func AddServer(server *Server)

AddServer adds a new server

func Comfirm added in v1.1.0

func Comfirm(label string) bool

func ConfigFile added in v1.1.0

func ConfigFile() string

func Connect

func Connect(server *Server)

Connect to the server.

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

func UpdateServer(name string, newServer *Server)

UpdateServer update a server by name

Types

type Options

type Options func(*Server)

func WithIdentityFile added in v1.1.0

func WithIdentityFile(identityFile string) Options

func WithPassword

func WithPassword(password string) Options

func WithPort

func WithPort(port int) Options

func WithUser

func WithUser(user string) Options

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

func EditFormPrompt(server *Server) *Server

EditFormPrompt prompts the user to modify the server fields, and returns the new server.

func FormPrompt

func FormPrompt(server *Server) *Server

func GetCurrentServer added in v1.1.0

func GetCurrentServer() *Server

GetCurrentServer returns the current server

func GetServer added in v1.1.0

func GetServer(name string) *Server

GetServer returns a server by name

func GetServers added in v1.1.0

func GetServers() []*Server

GetServers returns all the servers

func NewServer added in v1.1.0

func NewServer(name, host string, options ...Options) *Server

func SelectPrompt

func SelectPrompt(label string) (selected *Server)

SelectPrompt prompts the user to select a server, and returns the selected server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳