utils

package
v0.0.0-...-5810733 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All[T any](items []T, predicate func(T) bool) bool

func Any

func Any[T any](items []T, predicate func(T) bool) bool

func AnyCommandExists

func AnyCommandExists(cmds ...string) bool

func AnyFlatpakExists

func AnyFlatpakExists(flatpaks ...string) bool

func Clamp

func Clamp[T constraints.Ordered](val, min, max T) T

func CommandExists

func CommandExists(cmd string) bool

func Contains

func Contains[T comparable](items []T, target T) bool

func ExpandPath

func ExpandPath(path string) (string, error)

func Filter

func Filter[T any](items []T, predicate func(T) bool) []T

func Find

func Find[T any](items []T, predicate func(T) bool) (T, bool)

func FlatpakExists

func FlatpakExists(name string) bool

func FlatpakInPath

func FlatpakInPath() bool

func FlatpakInstallationDir

func FlatpakInstallationDir(name string) (string, error)

func FlatpakSearchBySubstring

func FlatpakSearchBySubstring(substring string) bool

func IsDBusServiceAvailable

func IsDBusServiceAvailable(busName string) bool

func Map

func Map[T, U any](items []T, transform func(T) U) []U

func XDGCacheHome

func XDGCacheHome() string

func XDGConfigHome

func XDGConfigHome() string

func XDGDataHome

func XDGDataHome() string

func XDGStateHome

func XDGStateHome() string

Types

type AppChecker

type AppChecker interface {
	CommandExists(cmd string) bool
	AnyCommandExists(cmds ...string) bool
	FlatpakExists(name string) bool
	AnyFlatpakExists(flatpaks ...string) bool
}

type DefaultAppChecker

type DefaultAppChecker struct{}

func (DefaultAppChecker) AnyCommandExists

func (DefaultAppChecker) AnyCommandExists(cmds ...string) bool

func (DefaultAppChecker) AnyFlatpakExists

func (DefaultAppChecker) AnyFlatpakExists(flatpaks ...string) bool

func (DefaultAppChecker) CommandExists

func (DefaultAppChecker) CommandExists(cmd string) bool

func (DefaultAppChecker) FlatpakExists

func (DefaultAppChecker) FlatpakExists(name string) bool

Jump to

Keyboard shortcuts

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