Documentation
¶
Index ¶
- Constants
- func Abs(path string) string
- func AddPathSuffix(os, path string, suffixes ...string) string
- func AppendToFile(s, target string) error
- func CommandExitCode(e error) (int, error)
- func CompareVersions(a, b string) int
- func Copy(src, dst string) error
- func CopyDir(src, dst string) error
- func CreateDir(path string) error
- func CreateFile(path string)
- func DeleteDir(dir string) error
- func DeleteFile(path string) error
- func DeleteHost(fileName, host string) error
- func DirExists(path string) bool
- func DownloadFile(dst string, url string) (err error)
- func DownloadFromUrl(url, destination string) (string, error)
- func DownloadFromUrlAsync(url, destination string, readBytesChannel chan int64, errorChan chan error) (string, int64, error)
- func DownloadFromUrlWithAttempts(url, destination string, retries int) (string, error)
- func DownloadFromUrlWithAttemptsAsync(url, destination string, retries int, wg *sync.WaitGroup) (string, *pb.ProgressBar, error)
- func DownloadQuiet(url, destination string) (string, error)
- func DownloadQuietAttempts(url, destination string, retries int) (string, error)
- func EstablishConn(ip, user, passwd string) bool
- func ExecCmd(cmdName string, cmdArgs []string) (string, error)
- func ExecStandardStd(name string, args ...string) error
- func ExecSudo(cb sudo.PasswordCallback, cbData interface{}, script ...string) (string, error)
- func Exists(fullFileName string) bool
- func ExitOnError(err error)
- func FileModeMask(name string, mask os.FileMode) (bool, error)
- func FileName(path string) string
- func GenericRunOverSsh(command, ip, user, password, port string, sudo bool, verbose bool, timeout int) (string, error)
- func GetArch() (string, error)
- func GetBinPath() string
- func GetExtractCommand(file string) string
- func GetFileLength(path string) (int64, error)
- func GetFinalUrl(url string) (string, error)
- func GetHTTPFileLength(url string) (int64, error)
- func GetTempDir() string
- func GetZipFiles(src string) ([]*zip.File, error)
- func HasAnySuffixes(file string, suffix ...string) bool
- func HashFileMD5(filePath string) (string, error)
- func LogCmdErrors(out, eut string, err error, args ...string)
- func LogError(err error)
- func NewHttpProxyReader(r io.Reader, f func(n int, err error)) io.Reader
- func RunOverSsh(command, ip, user, password string) (string, error)
- func RunSudoOverSsh(command, ip, user, password string, verbose bool) (string, error)
- func RunSudoOverSshTimeout(command, ip, user, password string, timeout int) (string, error)
- func Scp(src, dst, ip, user, password string) error
- func ScpWPort(src, dst, ip, port, user, password string) error
- func Separator() string
- func Separators(os string) string
- func StreamEasySsh(ip, user, password, port, key, command string, timeout int) (chan string, chan string, chan bool, error)
- func StringToSlice(a string, list []string) bool
- func Unzip(src, dest string) error
- func UserHomeDir() string
- func ValidURL(str string) bool
- func WaitAndSpin(message string, progress chan bool)
- func WaitJobAndSpin(message string, job *BackgroundJob) (err error)
- func WriteFile(path string, content string)
- func WriteToFile(s, target string) error
- type BackgroundJob
- type HttpProxyReader
- type Iface
- type RuneDecimalReader
- type RuneReader
Constants ¶
const ( SshExtendedCommandTimeout = 300 SshCommandTimeout = 30 )
Timeouts
Variables ¶
This section is empty.
Functions ¶
func AddPathSuffix ¶
AddPathSuffix joins path parts based on the OS
func CompareVersions ¶
func CreateFile ¶
func CreateFile(path string)
func DeleteFile ¶
func DeleteHost ¶
DeleteHost deletes host from ssh file or any other provided
func DownloadFile ¶
func DownloadFromUrl ¶
DownloadFromUrl downloads target file to destination folder create destination dir if does not exist download file if does not already exist shows progress bar
func DownloadFromUrlAsync ¶
func DownloadFromUrlAsync(url, destination string, readBytesChannel chan int64, errorChan chan error) (string, int64, error)
DownloadFromUrl downloads target file to destination folder, creates destination dir if does not exist download file if does not already exist shows progress bar
func DownloadFromUrlWithAttempts ¶
Downloads From url with retries
func DownloadFromUrlWithAttemptsAsync ¶
func DownloadFromUrlWithAttemptsAsync(url, destination string, retries int, wg *sync.WaitGroup) (string, *pb.ProgressBar, error)
Downloads from the url asynchronously
func DownloadQuiet ¶
func DownloadQuietAttempts ¶
Downloads From url with retries
func ExecStandardStd ¶
ExecStandardStd executes standard command and all in and out channels are redirected to os (i.e. os.Stdout..)
func ExecSudo ¶
func ExecSudo(cb sudo.PasswordCallback, cbData interface{}, script ...string) (string, error)
Executes commands via sudo
func FileModeMask ¶
return true if the given file is writable/readable/executable using the given mask by an owner
func GenericRunOverSsh ¶
func GenericRunOverSsh(command, ip, user, password, port string, sudo bool, verbose bool, timeout int) (string, error)
Generic command run over ssh, which configures ssh detail and calls RunSshWithTimeout method
func GetExtractCommand ¶
Returns extract command based on the filename
func GetFileLength ¶
func GetFinalUrl ¶
func GetHTTPFileLength ¶
func GetTempDir ¶
func GetTempDir() string
GetTempDir returns OS specific tmp folder location without trailing slash
func GetZipFiles ¶
GetZipFiles - gets the list of files inside zip archive
func HasAnySuffixes ¶
HasAnySuffixes returns true if file contains any of the supplied suffixes
func HashFileMD5 ¶
HashFileMD5 returns md5 hash for a specified file
func LogCmdErrors ¶
func NewHttpProxyReader ¶
Create new proxy reader over bar Takes io.Reader or io.ReadCloser
func RunOverSsh ¶
Run ssh command
func RunSudoOverSsh ¶
Run ssh echo password | sudo command
func RunSudoOverSshTimeout ¶
Run ssh echo password | sudo command with timeout
func StreamEasySsh ¶
func StreamEasySsh(ip, user, password, port, key, command string, timeout int) (chan string, chan string, chan bool, error)
Stream easy ssh
func StringToSlice ¶
func WaitAndSpin ¶
Shows the message and rotates a spinner while `progress` is true and isn't closed
func WaitJobAndSpin ¶
func WaitJobAndSpin(message string, job *BackgroundJob) (err error)
Types ¶
type BackgroundJob ¶
BackgroundJob contains 2 chans errors and progress indicating if task is in progress
func (*BackgroundJob) Active ¶
func (b *BackgroundJob) Active(active bool)
func (*BackgroundJob) Close ¶
func (b *BackgroundJob) Close()
func (*BackgroundJob) Error ¶
func (b *BackgroundJob) Error(err error)
type HttpProxyReader ¶
It's proxy reader, implement io.Reader
func (*HttpProxyReader) Close ¶
func (self *HttpProxyReader) Close() (err error)
Close the reader when it implements io.Closer
type RuneDecimalReader ¶
type RuneDecimalReader struct {
RuneReader
}
func (*RuneDecimalReader) ReadRuneOrDecimal ¶
func (v *RuneDecimalReader) ReadRuneOrDecimal() (val int32, size int, err error)