util

package module
v0.0.0-...-9b2e7d9 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2021 License: GPL-3.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileExists

func FileExists(filename string) bool

FileExists checks if file exists in given location.

func GetUsername

func GetUsername() string

GetUsername returns current username or empty if it cannot be fetched from OS.

func PromptAllowedString

func PromptAllowedString(question string, allowed []string, def string) string

PromptAllowedString prompts user an answer that is in the allowed slice. Returns default in case user gives empty answer.

func PromptPassword

func PromptPassword(question string) string

PromptPassword prompts password from user with given question. Password is not shown in terminal.

Types

type Logger

type Logger struct {
	*log.Logger
	// contains filtered or unexported fields
}

Logger struct.

func GetLogger

func GetLogger() *Logger

GetLogger creates singleton logger for envssh.

type Remote

type Remote struct {
	Username string
	Hostname string
	Port     uint16
}

Remote presents a SSH remote with username, hostname and port.

func ParseRemote

func ParseRemote(str string) *Remote

ParseRemote parses SSH remote from string. Takes into account username before last @ character and port after : character.

func (*Remote) ToAddress

func (remote *Remote) ToAddress() string

ToAddress returns hostname:port presentation of Remote.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL