localio

package
v2.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AptInstall

func AptInstall(packages *InstalledPackages, aptName ...string) error

AptInstall ...

func BrewInstallCaskProgram

func BrewInstallCaskProgram(brewName, brewFullName string, packages *InstalledPackages) error

BrewInstallCaskProgram ...

func BrewInstallProgram

func BrewInstallProgram(brewName, binaryName string, packages *InstalledPackages) error

BrewInstallProgram ...

func BrewTap

func BrewTap(brewTap string, packages *InstalledPackages) error

BrewTap ...

func CmdExec

func CmdExec(args ...string) (string, error)

CmdExec Execute a command and return stdout

func CommandExists

func CommandExists(cmd string) (string, bool)

CommandExists ...

func Contains

func Contains(s []string, str string) bool

Contains checks if a string is present in a slice

func CopyStringToFile

func CopyStringToFile(data, dest string) error

CopyStringToFile ...

func CorrectOS

func CorrectOS(osType string) bool

CorrectOS ... Useful for go tests

func DownloadAndInstallLatestVersionOfGolang

func DownloadAndInstallLatestVersionOfGolang(homeDir string, packages *InstalledPackages) error

DownloadAndInstallLatestVersionOfGolang Only for linux x86_64. Mac uses homebrew

func DownloadFile

func DownloadFile(dest, url string) error

DownloadFile ...

func EmbedFileCopy

func EmbedFileCopy(dst string, src fs.File) error

EmbedFileCopy ...

func EmbedFileStringAppendToDest

func EmbedFileStringAppendToDest(data []byte, dest string) error

EmbedFileStringAppendToDest takes a slice of bytes and writes it as a string to dest file path

func EmbedFileStringPrependToDest

func EmbedFileStringPrependToDest(data []byte, dest string) error

EmbedFileStringPrependToDest takes a slice of bytes and prepend writes it as a string to the beginning of the dest file path

func ExecCMD

func ExecCMD(command string) (string, error)

ExecCMD Execute a command

func Exists

func Exists(path string) (bool, error)

Exists returns whether the given file or directory exists

func GetCPUType

func GetCPUType() string

GetCPUType Returns the CPU type for the current runtime environment

func GitClone

func GitClone(url, directory string) error

GitClone clones a public git repo url to directory

func Infof added in v2.1.3

func Infof(format string, args ...interface{})

Infof ...

func InstallPipPackages added in v2.1.3

func InstallPipPackages(installedPackages *PipInstalled, pkgName ...string) error

InstallPipPackages ...

func IsRoot added in v2.1.3

func IsRoot() bool

IsRoot checks if the current user is root or not

func LogError added in v2.1.3

func LogError(err error) error

LogError ...

func LogWarningf added in v2.1.3

func LogWarningf(format string, args ...interface{})

LogWarningf logs a warning to stdout

func PipInstall added in v2.1.3

func PipInstall(packagesToInstall []string) error

PipInstall ...

func ResolveAbsPath

func ResolveAbsPath(path string) (string, error)

ResolveAbsPath ...

func RunCommandPipeOutput

func RunCommandPipeOutput(command string) error

RunCommandPipeOutput runs a bash command and pipes the output to stdout and stderr in realtime

func RunCommands

func RunCommands(cmds []string) error

RunCommands ...

func SetVariableValue

func SetVariableValue(varName, val, osType, configPath string) error

SetVariableValue ...

func StartTmuxSession

func StartTmuxSession() error

StartTmuxSession ...

func TimeTrack added in v2.1.3

func TimeTrack(start time.Time, name string)

TimeTrack ...

func VersionGreaterOrEqual added in v2.1.3

func VersionGreaterOrEqual(versionString string, minVersionString string) bool

VersionGreaterOrEqual ...

Types

type AptInstalled

type AptInstalled struct {
	Name []string
}

AptInstalled ...

func NewAptInstalled

func NewAptInstalled() (*AptInstalled, error)

NewAptInstalled ...

type BrewInstalled

type BrewInstalled struct {
	Names         []string
	CaskFullNames []string
	Taps          []string
}

BrewInstalled ...

func NewBrewInstalled

func NewBrewInstalled() (*BrewInstalled, error)

NewBrewInstalled ...

type Directories

type Directories struct {
	HomeDir string
}

Directories ...

func NewDirectories

func NewDirectories() (*Directories, error)

NewDirectories ...

type InstalledPackages

type InstalledPackages struct {
	AptInstalledPackages  *AptInstalled
	BrewInstalledPackages *BrewInstalled
}

InstalledPackages ...

type PipInstalled added in v2.1.3

type PipInstalled struct {
	Name     []string
	Versions PythonVersions
}

func NewPipInstalled added in v2.1.3

func NewPipInstalled() (*PipInstalled, error)

NewPipInstalled returns a slice of all the installed python3 pip packages

type PythonVersions added in v2.1.3

type PythonVersions struct {
	Python3Version string
	PipVersion     string
}

func GetPythonAndPipVersion added in v2.1.3

func GetPythonAndPipVersion() (*PythonVersions, error)

GetPythonAndPipVersion ...

type Record

type Record struct {
	Filename string
	Contents []string
}

Record is a type for prepending string text to a file

func NewRecord

func NewRecord(filename string) *Record

NewRecord returns the Record type

func (*Record) PrependStringToFile

func (r *Record) PrependStringToFile(content string) error

PrependStringToFile prepends a given string to an existing file while preserving the original formatting

type Version added in v2.1.3

type Version struct {
	Major int
	Minor int
	Patch int
}

Jump to

Keyboard shortcuts

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