Documentation ¶
Index ¶
- Variables
- func ArgumentsCheck(argCount, min, max int) error
- func GetFilePaths(p string) ([]string, error)
- func GetHomeDir() string
- func GetUsername() string
- func ParseConnect(connect string) (string, string, string)
- func Query(values, keys []string, ignoreCase bool) bool
- func SortKeys(m map[string]string) []string
- type AddOption
- type HostConfig
- func Add(p string, ao *AddOption) (*HostConfig, error)
- func Delete(p string, aliases ...string) ([]*HostConfig, error)
- func List(p string, lo ListOption) ([]*HostConfig, error)
- func NewHostConfig(alias, path string, host *sshconfig.Host) *HostConfig
- func Update(p string, uo *UpdateOption) (*HostConfig, error)
- type ListOption
- type UpdateOption
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // SuccessFlag success flag SuccessFlag = color.GreenString("✔ ") // ErrorFlag error flag ErrorFlag = color.RedString("✗ ") )
Functions ¶
func ArgumentsCheck ¶
ArgumentsCheck check arguments count correctness
func ParseConnect ¶
ParseConnect parse connect string, format is [user@]host[:port]
Types ¶
type AddOption ¶
type AddOption struct { // Path add path Path string // Alias alias Alias string // Connect connection string Connect string // Config other config Config map[string]string }
AddOption options for Add
type HostConfig ¶
type HostConfig struct { // Alias alias Alias string // Path found in which file Path string // PathMap key is file path, value is the alias's hosts PathMap map[string][]*sshconfig.Host // OwnConfig own config OwnConfig map[string]string // ImplicitConfig implicit config ImplicitConfig map[string]string }
HostConfig struct include alias, connect string and other config
func Add ¶
func Add(p string, ao *AddOption) (*HostConfig, error)
Add ssh host config to ssh config file
func Delete ¶
func Delete(p string, aliases ...string) ([]*HostConfig, error)
Delete existing alias record
func List ¶
func List(p string, lo ListOption) ([]*HostConfig, error)
List ssh alias, filter by optional keyword
func NewHostConfig ¶
func NewHostConfig(alias, path string, host *sshconfig.Host) *HostConfig
NewHostConfig new HostConfig
func (*HostConfig) ConnectionStr ¶
func (hc *HostConfig) ConnectionStr() string
ConnectionStr return the connection string
func (*HostConfig) Display ¶
func (hc *HostConfig) Display() bool
Display Whether to display connection string
type ListOption ¶
type ListOption struct { // Keywords set Keyword filter records Keywords []string // IgnoreCase ignore case IgnoreCase bool }
ListOption options for List
Click to show internal directories.
Click to hide internal directories.