Documentation
¶
Overview ¶
Package utils contains various utility methods
Index ¶
- func AppDir(appName, userDefinedPath string) (string, error)
- func BuildProcess(cmd string) *exec.Cmd
- func BuildProcessInterceptStdAll(command string) *exec.Cmd
- func BuildProcessInterceptStdErr(command string) *exec.Cmd
- func CheckAppInstalled(appName string) error
- func CreateAppDirIfNotExists(appConfigDir string) error
- func RemoveDuplicateSpaces(arguments string) string
- func SSHConfigFilePath(userDefinedPath string) (string, error)
- func StringAbbreviation(s string) string
- func StringEmpty(s *string) bool
- func StripStyles(input string) string
- type ProcessBufferWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppDir ¶ added in v0.3.0
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 BuildProcess ¶ added in v0.3.0
BuildProcess - builds exec.Cmd object from command string.
func BuildProcessInterceptStdAll ¶ added in v1.2.0
BuildProcessInterceptStdAll - builds a process where both stdout and stderr are intercepted for further processing.
func BuildProcessInterceptStdErr ¶ added in v1.2.0
BuildProcessInterceptStdErr - builds a process where stderr is intercepted for further processing.
func CheckAppInstalled ¶ added in v0.3.0
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
CreateAppDirIfNotExists - creates application home folder if it doesn't exist. appConfigDir is application home folder path.
func RemoveDuplicateSpaces ¶ added in v1.1.0
RemoveDuplicateSpaces - removes two or more spaces from the string.
func SSHConfigFilePath ¶ added in v1.4.0
func StringAbbreviation ¶ added in v1.3.0
StringAbbreviation - creates an abbreviation from a string, combining starting letters from first and last words. For example:
"Alexandria, Egypt" -> "AE" "Babylon Iraq" -> "BI" "Carthage, North Africa" -> "CA" "Thebes_Greece" -> "TG"
func StringEmpty ¶ added in v0.4.0
StringEmpty - checks if string is empty or contains only spaces. s is string to check.
func StripStyles ¶ added in v1.3.0
StripStyles - removes lipgloss styles from a string.
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 a temporary buffer variable for future reading and doesn't write anything in terminal. Utilized to parse process stdout or stderr.