utils

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandExists

func CommandExists(cmd string) bool

CommandExists checks if a command is available in PATH

func Contains

func Contains(slice []string, item string) bool

Contains checks if a string slice contains a specific item

func FormatFileSize

func FormatFileSize(size int64) string

FormatFileSize formats a file size in bytes to a human-readable string

func FormatFileSizeColored

func FormatFileSizeColored(size int64) string

FormatFileSizeColored returns a color-styled file size string based on size ranges

func GetDriveLabel added in v1.0.3

func GetDriveLabel(path string) string

GetDriveLabel returns a human-readable label for a drive path

func GetFileIcon

func GetFileIcon(name string) string

GetFileIcon returns an emoji icon for a file based on its extension

func GetMountedDrives added in v1.0.3

func GetMountedDrives() []string

GetMountedDrives returns a list of all mounted drives/volumes

func HighlightMatches

func HighlightMatches(text string, matches []int) string

HighlightMatches highlights matched characters in a string

func IsCodeFile

func IsCodeFile(name string) bool

IsCodeFile returns true if the file is a code file based on extension

func IsImageFile

func IsImageFile(name string) bool

IsImageFile returns true if the file is an image based on extension

func IsTextPreviewable added in v1.0.3

func IsTextPreviewable(path string) bool

IsTextPreviewable returns true if we should attempt text preview

func Min

func Min(a, b int) int

Min returns the minimum of two integers

func NormalizeToWSLPath added in v1.0.3

func NormalizeToWSLPath(path string) string

NormalizeToWSLPath normalizes Windows-style paths to WSL format Examples: "L:" -> "/mnt/l", "L:\\" -> "/mnt/l", "L:/foo" -> "/mnt/l/foo" Leaves WSL paths unchanged: "/mnt/l" -> "/mnt/l"

func ShouldIgnore

func ShouldIgnore(name string) bool

ShouldIgnore returns true if a file/directory should be ignored

Types

type FileType added in v1.0.3

type FileType int

FileType represents the category of a file for preview handling

const (
	FileTypeText FileType = iota
	FileTypeCode
	FileTypeMedia
	FileTypeDocument
	FileTypeArchive
	FileTypeExecutable
	FileTypeDatabase
	FileTypeFont
	FileTypeUnknown
)

func GetFileType added in v1.0.3

func GetFileType(path string) FileType

GetFileType returns the category of file based on extension

Jump to

Keyboard shortcuts

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