utils

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package utils contains various utility methods

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppDir added in v0.3.0

func AppDir(appName, userDefinedPath string) (string, error)

AppDir - returns application home folder where all files are stored. appName is application name which will be used as folder name. userDefinedPath allows you to set a custom path to application home folder, can be relative or absolute. If userDefinedPath is not empty, it will be used as application home folder Else, userConfigDir will be used, which is system dependent.

func BuildConnectSSH added in v1.1.0

func BuildConnectSSH(command string) *exec.Cmd

BuildConnectSSH - builds ssh command which is based on host.Model.

func BuildLoadSSHConfig added in v1.1.0

func BuildLoadSSHConfig(command string) *exec.Cmd

BuildLoadSSHConfig - builds ssh command, which runs ssh -G <hostname> command to get a list of options associated with the hostname.

func BuildProcess added in v0.3.0

func BuildProcess(cmd string) *exec.Cmd

BuildProcess - builds exec.Cmd object from command string.

func CheckAppInstalled added in v0.3.0

func CheckAppInstalled(appName string) error

CheckAppInstalled - checks if application is installed and can be found in executable path appName - name of the application to be looked for in $PATH.

func CreateAppDirIfNotExists added in v0.2.0

func CreateAppDirIfNotExists(appConfigDir string) error

CreateAppDirIfNotExists - creates application home folder if it doesn't exist. appConfigDir is application home folder path.

func RemoveDuplicateSpaces added in v1.1.0

func RemoveDuplicateSpaces(arguments string) string

RemoveDuplicateSpaces - removes two or more spaces from the string.

func StringEmpty added in v0.4.0

func StringEmpty(s string) bool

StringEmpty - checks if string is empty or contains only spaces. s is string to check.

Types

type ProcessBufferWriter added in v1.1.0

type ProcessBufferWriter struct {
	Output []byte
}

ProcessBufferWriter - is an object which pretends to be a writer, however it saves all data into 'Output' variable for future reading and do not write anything in terminal. We need it to display or parse process output or error.

func (*ProcessBufferWriter) Write added in v1.1.0

func (writer *ProcessBufferWriter) Write(p []byte) (n int, err error)

Write - doesn't write anything, it saves all data in err variable, which can ve read later.

Jump to

Keyboard shortcuts

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