utils

package
v0.0.0-...-c450bb1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ColorCyan = "\033[36m"
View Source
var ColorGreen = "\033[92m"
View Source
var ColorRed = "\033[91m"
View Source
var ColorReset = "\033[0m"

define text color

View Source
var ColorYellow = "\033[33m"

Functions

func AppendToFile

func AppendToFile(line string, file string) error

func CheckIfExists

func CheckIfExists(fileOrDir string) (bool, error)

func ChkIfCmdRuns

func ChkIfCmdRuns(c *exec.Cmd) error

func Confirm

func Confirm() bool

Response confirmation handling

func Copy

func Copy(src, dst string) error

func CreateDirIfNotExist

func CreateDirIfNotExist(dir string)

func DeleteDirIfEmpty

func DeleteDirIfEmpty(dir string)

func DirIsEmpty

func DirIsEmpty(dir string) (bool, error)

func EditSettings

func EditSettings(lType, value string)

func GetFileExtension

func GetFileExtension(filename string) string

func GetFileFromFullPath

func GetFileFromFullPath(file string) string

func GetFileFromUrl

func GetFileFromUrl(url string) string

func GetFileName

func GetFileName(filename string) string

func GetNameFromUrl

func GetNameFromUrl(g string) (string, string)

func GetNativePkgMgr

func GetNativePkgMgr() string

func GetRepoName

func GetRepoName(p, pType, g string) string

func GetRepoRestoreType

func GetRepoRestoreType(pm, repo string) string

func GetRepoType

func GetRepoType(s string) string

func GetWorkPath

func GetWorkPath() string

func HasWhiteSpace

func HasWhiteSpace(input string) bool

func History

func History(pm, p string, sorted bool)

func IsLocalInstall

func IsLocalInstall(filename string) (bool, string, string)

func IsPPA

func IsPPA(p string) bool

func IsScript

func IsScript(p string) bool

func IsUrl

func IsUrl(p string) bool

func ListRepo

func ListRepo(pm, r string)

func LogLaunchBanner

func LogLaunchBanner(version string)

Display header banner

func NewLine

func NewLine()

Insert newline in log

func PrintError

func PrintError(eType string, e error)

Print error

func PrintErrorExit

func PrintErrorExit(eType string, e error)

Print error and exit

func PrintErrorMsg

func PrintErrorMsg(eType string, e string)

Print error msg and exit

func PrintErrorMsgExit

func PrintErrorMsgExit(eType string, e string)

Print error msg and exit

func RandString

func RandString(nByte int) (string, error)

Function to generate a random string

func ReadFileLine

func ReadFileLine(file string, line int) (string, error)

func RemoveDirRecursive

func RemoveDirRecursive(dir string)

func RemoveFile

func RemoveFile(file string)

func RemoveFileLine

func RemoveFileLine(file string, ln int)

func RunCmd

func RunCmd(c *exec.Cmd, msg string)

func RunCmdQuiet

func RunCmdQuiet(c *exec.Cmd, msg string)

func RunCmdReturn

func RunCmdReturn(c *exec.Cmd) (string, error)

func StripExtension

func StripExtension(filename, ext string) string

func TimeStamp

func TimeStamp(ts bool)

Toggle on and off timestamp in logging

func UpdateApp

func UpdateApp()

func WriteDotDesktop

func WriteDotDesktop(pkg, icon, file, dest, share string)

func WriteToFile

func WriteToFile(line string, file string) error

Types

type DotDesktop

type DotDesktop struct {
	Name string
	Icon string
}

func ReadDotDesktop

func ReadDotDesktop(file string) (*DotDesktop, error)

Jump to

Keyboard shortcuts

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