helper

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// IsGnuTar show tar type
	IsGnuTar = false
)

Functions

func AbsolutePath

func AbsolutePath(path string) string

Convert a file path into an absolute path

func CleanHost

func CleanHost(host string) string

CleanHost clean host url ftp://foo.bar.com -> foo.bar.com

func Exec

func Exec(command string, args ...string) (output string, err error)

Exec cli commands

func ExecWithStdio

func ExecWithStdio(command string, stdout bool, args ...string) (output string, err error)

ExecWithStdio cli commands with stdio

func ExplandHome

func ExplandHome(filePath string) string

ExplandHome ~/foo -> /home/hant/foo

func FormatEndpoint

func FormatEndpoint(endpoint string) string

FormatEndpoint to add `https://` prefix if not present

func IsExistsPath

func IsExistsPath(p string) bool

IsExistsPath check path exist

func MkdirP

func MkdirP(dirPath string) error

MkdirP like mkdir -p

Types

type ProgressBar

type ProgressBar struct {
	FileLength int64
	Reader     io.Reader
	// contains filtered or unexported fields
}

func NewProgressBar

func NewProgressBar(myLogger logger.Logger, reader *os.File) ProgressBar

func (ProgressBar) Done

func (p ProgressBar) Done(url string)

func (ProgressBar) Errorf

func (p ProgressBar) Errorf(format string, err ...any) error

Jump to

Keyboard shortcuts

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