tools

package
v0.0.0-...-ae07d5c Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InstallerName = installerName
	InstallerPath = GetPath()
)

Functions

func ExitWithError

func ExitWithError(format string, args ...any)

func FindIndexOf

func FindIndexOf[T comparable](slice []T, what T) (int, bool)

func GetPath

func GetPath() string

func IsValidFolder

func IsValidFolder(path string) bool

func List

func List() ([]string, error)

func NormalizePath

func NormalizePath(filePath string, root string) string

func NormalizePathWithExt

func NormalizePathWithExt(filePath, rootPath, ext string) string

func Perror

func Perror(format string, args ...any)

func RemoveAtIndex

func RemoveAtIndex[T comparable](slice []T, index int) []T

func TgzCompress

func TgzCompress(source, target string) error

Compress the source folder to the target .tgz archive file

func TgzExtract

func TgzExtract(source, target string) error

func TgzList

func TgzList(source string) error

func TrimString

func TrimString(s string, length int) string

func Unique

func Unique(s []string) []string

func ZipCompress

func ZipCompress(source, target string) error

func ZipExtract

func ZipExtract(source, target string) error

func ZipList

func ZipList(source string) error

Types

type Traverse

type Traverse struct {
	Root        string
	EnterFolder TraverseCallback
	ExitFolder  TraverseCallback
	ProcessFile TraverseCallback
}

func NewTraverse

func NewTraverse(root string) *Traverse

func (*Traverse) Run

func (t *Traverse) Run() error

func (*Traverse) WithOnEnterFolder

func (t *Traverse) WithOnEnterFolder(OnEnter TraverseCallback) *Traverse

func (*Traverse) WithOnExitFolder

func (t *Traverse) WithOnExitFolder(OnExit TraverseCallback) *Traverse

func (*Traverse) WithProcessFile

func (t *Traverse) WithProcessFile(Process TraverseCallback) *Traverse

type TraverseCallback

type TraverseCallback func(name string) bool

Jump to

Keyboard shortcuts

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