util

package
v0.0.62 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileExists

func FileExists(filename string) bool

FileExists checks if a file exists and is not a directory before we try using it to prevent further errors.

func IsForegroundProcess added in v0.0.62

func IsForegroundProcess(fd uintptr) bool

IsForegroundProcess reports whether this process belongs to the foreground process group of the terminal referred to by fd. Reading or reconfiguring a terminal from a background process group suspends the process with SIGTTIN/SIGTTOU — e.g. inside process substitution: `source <(lets completion -s zsh)`.

func IsTerminalWriter added in v0.0.62

func IsTerminalWriter(w io.Writer) bool

IsTerminalWriter reports whether w is connected to an interactive terminal. Writers that are not backed by a file descriptor (e.g. buffers used in tests, or pipes) are treated as non-terminals.

func LetsUserDir

func LetsUserDir() (string, error)

func LetsUserFile

func LetsUserFile(name string) (string, error)

func OpenEditor added in v0.0.62

func OpenEditor(path string) error

func OpenURL

func OpenURL(url string) error

func ParseVersion

func ParseVersion(version string) (*semver.Version, error)

func SafeCreateDir

func SafeCreateDir(dirPath string) error

func WriteFileAtomic added in v0.0.62

func WriteFileAtomic(dst string, data []byte) error

WriteFileAtomic writes data to dst via a sibling temp file and an os.Rename, so dst is never left in a partially-written state if the process is interrupted. The resulting file has 0o644 permissions.

Types

This section is empty.

Jump to

Keyboard shortcuts

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