util

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrClipboardNotSupported is returned when the OS doesn't support clipboard operations
	ErrClipboardNotSupported = errors.New("clipboard not supported on this OS")
	// ErrClipboardUtilityNotFound is returned when clipboard utility is not available
	ErrClipboardUtilityNotFound = errors.New("clipboard utility not found")
)

Functions

func ChangeModeIfNot

func ChangeModeIfNot(src string, mode os.FileMode) error

ChangeModeIfNot Change the permission mode of a file if it is not the same as the specified mode

func CompareVersion

func CompareVersion(v1, v2 string) int

func CopyFile

func CopyFile(src, dst string) error

func CopyToClipboard

func CopyToClipboard(text string) error

CopyToClipboard copies the given text to the system clipboard Returns nil if successful, error otherwise

func FileExists

func FileExists(filename string) bool

func GetBeginOfToday

func GetBeginOfToday() int64

func GetTimestamp

func GetTimestamp() int64

func IsBeforeToday

func IsBeforeToday(timestamp int64) bool

func IsExecutable

func IsExecutable(src string) bool

IsExecutable Check if a file is executable

func IsNonInteractiveTerminal

func IsNonInteractiveTerminal() bool

IsNonInteractiveTerminal checks if the current environment is non-interactive. Returns true if running in CI or if stdout is not a terminal (e.g., piped output).

func IsTTY

func IsTTY() bool

IsTTY checks if the process is running in a TTY (interactive terminal)

func MkSymlink(oldname, newname string) (err error)

MkSymlink Create a symbolic link

func MoveFiles

func MoveFiles(src, targetDir string) error

MoveFiles Move a folder or file to a specified directory

Types

type ArchType

type ArchType string

func GetArchType

func GetArchType() ArchType

type Bzip2TarDecompressor

type Bzip2TarDecompressor struct {
	// contains filtered or unexported fields
}

func (*Bzip2TarDecompressor) Decompress

func (b *Bzip2TarDecompressor) Decompress(dest string) error

type Decompressor

type Decompressor interface {
	Decompress(dest string) error
}

func NewDecompressor

func NewDecompressor(src string) Decompressor

type Downloader

type Downloader struct {
	// URL is the URL to download the SDK from.
	LocalPath string `json:"local_path"`
}

func NewDownloader

func NewDownloader(localPath string) *Downloader

func (*Downloader) Download

func (d *Downloader) Download(url *url.URL) (string, error)

type ErrorStore

type ErrorStore struct {
	// contains filtered or unexported fields
}

ErrorStore is a struct that stores errors

func NewErrorStore

func NewErrorStore() *ErrorStore

NewErrorStore creates a new ErrorStore

func (*ErrorStore) Add

func (e *ErrorStore) Add(note string, err error)

Add adds an error to the store

func (*ErrorStore) AddAndShow

func (e *ErrorStore) AddAndShow(note string, err error)

Add and show in the console

func (*ErrorStore) GetNotes

func (e *ErrorStore) GetNotes() []string

get all error notes

func (*ErrorStore) GetNotesSet

func (e *ErrorStore) GetNotesSet() Set[string]

get notes set

func (*ErrorStore) HasError

func (e *ErrorStore) HasError() bool

type GzipTarDecompressor

type GzipTarDecompressor struct {
	// contains filtered or unexported fields
}

func (*GzipTarDecompressor) Decompress

func (g *GzipTarDecompressor) Decompress(dest string) error

type MapSet

type MapSet[T comparable] struct {
	// contains filtered or unexported fields
}

func (*MapSet[T]) Add

func (s *MapSet[T]) Add(v T) bool

func (*MapSet[T]) Contains

func (s *MapSet[T]) Contains(v T) bool

func (*MapSet[T]) Len

func (s *MapSet[T]) Len() int

func (*MapSet[T]) Remove

func (s *MapSet[T]) Remove(v T)

func (*MapSet[T]) Slice

func (s *MapSet[T]) Slice() []T

type OSType

type OSType string

func GetOSType

func GetOSType() OSType

type Set

type Set[T comparable] interface {
	Add(v T) bool
	Remove(v T)
	Contains(v T) bool
	Len() int
	Slice() []T
}

func NewSet

func NewSet[T comparable]() Set[T]

func NewSetWithSlice

func NewSetWithSlice[T comparable](slice []T) Set[T]

func NewSortedSetWithSlice

func NewSortedSetWithSlice[T comparable](slice []T) Set[T]

type SevenZipDecompressor

type SevenZipDecompressor struct {
	// contains filtered or unexported fields
}

func (*SevenZipDecompressor) Decompress

func (s *SevenZipDecompressor) Decompress(dest string) error

type SortedSet

type SortedSet[T comparable] struct {
	// contains filtered or unexported fields
}

func NewSortedSet

func NewSortedSet[T comparable]() *SortedSet[T]

func (*SortedSet[T]) Add

func (s *SortedSet[T]) Add(v T) bool

func (*SortedSet[T]) AddWithIndex

func (s *SortedSet[T]) AddWithIndex(index int, v T) bool

func (*SortedSet[T]) Contains

func (s *SortedSet[T]) Contains(v T) bool

func (*SortedSet[T]) Len

func (s *SortedSet[T]) Len() int

func (*SortedSet[T]) Remove

func (s *SortedSet[T]) Remove(v T)

func (*SortedSet[T]) Slice

func (s *SortedSet[T]) Slice() []T

type VersionSort

type VersionSort []string

func (VersionSort) Len

func (s VersionSort) Len() int

func (VersionSort) Less

func (s VersionSort) Less(i, j int) bool

func (VersionSort) Swap

func (s VersionSort) Swap(i, j int)

type XZTarDecompressor

type XZTarDecompressor struct {
	// contains filtered or unexported fields
}

func (*XZTarDecompressor) Decompress

func (g *XZTarDecompressor) Decompress(dest string) error

type ZipDecompressor

type ZipDecompressor struct {
	// contains filtered or unexported fields
}

func (*ZipDecompressor) Decompress

func (z *ZipDecompressor) Decompress(dest string) error

Jump to

Keyboard shortcuts

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