Documentation
¶
Index ¶
- Constants
- Variables
- func BoolValue(b *bool) bool
- func Confirm(msg string) bool
- func DownloadAndExtract(url, dest, targetName string, giveExec bool) error
- func DownloadUrl(url, dest string) error
- func ExtractArchive(src, dest string) error
- func ExtractBinary(src, dest, binaryName string) error
- func ExtractBz2(src, dest string) error
- func ExtractSingleFile(archivePath, destPath, targetName string) error
- func ExtractTgz(src, dest string) error
- func ExtractZip(src, dest string) error
- func FindBinary(binaryNames map[string]string, destFolder string) (string, error)
- func FormatErrors(errs []error) string
- func FormatFileSize(bytes int64) string
- func GetFileExtensionFromURL(rawurl string) (string, error)
- func GetRemoteFileSize(url string) string
- func GiveExecutePerms(path string) error
- func HandleError(err error, msg ...string)
- func NewSpinner(cfg yacspin.Config)
- func OpenURL(url string) error
- func SetSpinnerQuiet(quiet bool)
- func SpinnerConfig() yacspin.Config
Constants ¶
const ( RedColor = "\033[31m" YellowColor = "\033[33m" BlueColor = "\033[34m" ResetColor = "\033[0m" )
ANSI escape codes for color
Variables ¶
var (
Spinner *yacspin.Spinner
)
global spinner
Functions ¶
func BoolValue ¶ added in v0.2.2
boolValue safely dereferences a bool pointer, returning false if nil
func DownloadAndExtract ¶ added in v0.2.4
DownloadAndExtract downloads an archive from url, extracts it to dest. If targetName is specified, only that file is kept (others are removed). If giveExec is true, execute permissions are added to the target file. The archive is cleaned up after extraction.
func DownloadUrl ¶ added in v0.2.0
downloads a file from a url and places it in a specified destination
func ExtractArchive ¶ added in v0.2.4
ExtractArchive auto-detects the archive format and extracts it.
func ExtractBinary ¶ added in v0.2.4
ExtractBinary extracts an archive and gives execute permissions to the specified binary.
func ExtractBz2 ¶ added in v0.2.4
ExtractBz2 extracts a .tar.bz2 archive to the destination directory.
func ExtractSingleFile ¶ added in v0.2.4
ExtractSingleFile extracts a single file from an archive to destPath. It searches for a file matching targetName anywhere in the archive.
func ExtractTgz ¶ added in v0.2.4
ExtractTgz extracts a .tar.gz or .tgz archive to the destination directory.
func ExtractZip ¶ added in v0.2.4
ExtractZip extracts a zip archive to the destination directory.
func FindBinary ¶ added in v0.2.2
FindBinary checks that the binary exists in dest or $PATH, preferring $PATH. Checks that binary also has executable permissions.
func FormatErrors ¶ added in v0.1.6
Formats a slice of errors to a single error, each seperated by a new line
func FormatFileSize ¶ added in v0.2.4
FormatFileSize formats bytes into human-readable format (KB, MB, GB).
func GetFileExtensionFromURL ¶ added in v0.1.7
func GetRemoteFileSize ¶ added in v0.2.4
GetRemoteFileSize returns the size of a remote file in a human-readable format. Returns empty string if size cannot be determined.
func GiveExecutePerms ¶ added in v0.2.4
GiveExecutePerms adds execute permissions to a file.
func HandleError ¶ added in v0.1.6
Prints the error in red and exits
func SetSpinnerQuiet ¶ added in v0.2.2
func SetSpinnerQuiet(quiet bool)
Sets the spinner to quiet mode by discarding all output to not interfere with Unix pipes or redirections
func SpinnerConfig ¶ added in v0.2.2
Types ¶
This section is empty.