helpers

package
v0.1.62 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcquireLock

func AcquireLock(path string) error

func BreakStaleLock

func BreakStaleLock(path string) (bool, error)

func Chown

func Chown(path string, uid, gid string) error

func CliMask

func CliMask(condition bool, textTrue string, textFalse string) string

func CliRemoveComa

func CliRemoveComa(text string) string

func Confirm

func Confirm(message string) bool

func Editor

func Editor(jsonBytes []byte) ([]byte, bool, error)

func EnforceHTTPS

func EnforceHTTPS(raw string) (*url.URL, error)

func GetLogLevel

func GetLogLevel(level string) zapcore.Level

func GetRealHome

func GetRealHome() string

func GetRealUser

func GetRealUser() (*user.User, error)

func GetSanitizedDirectoryPath

func GetSanitizedDirectoryPath(path string) string

func IsRunningAsSudo

func IsRunningAsSudo() bool

func LogIfError

func LogIfError(err error)

func PrintAndExit

func PrintAndExit(err error, code int)

func PrintBytes

func PrintBytes(ctx context.Context, reader io.ReadCloser) error

func PrintBytesDemux

func PrintBytesDemux(ctx context.Context, reader io.ReadCloser) error

func ReleaseAllLocks

func ReleaseAllLocks()

ReleaseAllLocks releases all locks held by this process

func ReleaseLock

func ReleaseLock(path string) error

func RemoveElement

func RemoveElement[T any](slice []T, k int) []T

func WaitForFileToAppear

func WaitForFileToAppear(ctx context.Context, path string, interval time.Duration) error

Types

type LockManager

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

func NewLockManager

func NewLockManager() *LockManager

func (*LockManager) Acquire

func (lm *LockManager) Acquire(path string) error

func (*LockManager) Release

func (lm *LockManager) Release(path string) error

func (*LockManager) ReleaseAll

func (lm *LockManager) ReleaseAll()

type LockStatus

type LockStatus struct {
	Exists   bool
	Locked   bool
	LockedBy int
	Stale    bool
}

func CheckLock

func CheckLock(path string) (LockStatus, error)

type RealUser

type RealUser struct {
	Username string
	Uid      int
	Gid      int
}

Jump to

Keyboard shortcuts

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