Documentation ¶
Index ¶
- Constants
- Variables
- func AsMask(sar []string) uint32
- func BuildWalkDirFn(fns []Filter, res *Result) func(string, fs.DirEntry, error) error
- func Clamp[T constraints.Ordered](val, lower, upper T) (res T)
- func GenNgrams(sar []string, n int) (map[string]int, int)
- func GetScoringFunction(queries []string) func(string) float32
- func ImplicitSlice(opts *Options)
- func Initialize(opts *Options) (*Result, []Filter, []Process)
- func PrintWithBuf(files []*Finfo, opts *Options)
- func ProcessList(res *Result, fns []Process)
- func RegisterMasks(mask uint32, keys ...string)
- func Reverse[T any](filenames []T) []T
- func Slice[T any](pat string, input []T) (_ []T, err error)
- func SortByScore[T any](files ScoredFiles[T])
- func StrToMask(str string) uint32
- func Traverse(wfn fs.WalkDirFunc, opts *Options)
- func TraverseZip(path string, depth int, wfn fs.WalkDirFunc, opts *Options)
- type Filter
- type FilterOpts
- type Finfo
- type ListingOpts
- type Options
- type Printing
- type Process
- type ProcessOpts
- type Result
- type ScoredFiles
- type SortBy
- type TreeNode
- type ZipEntry
Constants ¶
View Source
const ( Other = "other" Image = "image" Video = "video" Audio = "audio" Archive = "archive" ZipLike = "zip" MaskImage uint32 MaskVideo MaskAudio MaskArchive MaskZipLike = 1<<iota + MaskArchive )
View Source
const N = 3
Variables ¶
View Source
var CntMap = map[string]uint32{}
View Source
var CntMasks = map[uint32][]string{ MaskImage: {".jpg", ".jpeg", ".png", ".apng", ".gif", ".bmp", ".webp", ".avif", ".jxl", ".tiff"}, MaskVideo: {".mp4", ".m4v", ".webm", ".mkv", ".avi", ".mov", ".mpg", ".mpeg"}, MaskAudio: {".m4a", ".opus", ".ogg", ".mp3", ".flac", ".wav", ".aac"}, MaskArchive: {".zip", ".rar", ".7z", ".tar", ".gz", ".bz2", ".xz", ".lz4", ".zst", ".lzma", ".lzip", ".lz", ".cbz"}, MaskZipLike: {".zip", ".cbz", ".cbr"}, }
Functions ¶
func BuildWalkDirFn ¶
func Clamp ¶
func Clamp[T constraints.Ordered](val, lower, upper T) (res T)
func GetScoringFunction ¶
func ImplicitSlice ¶
func ImplicitSlice(opts *Options)
func PrintWithBuf ¶
func ProcessList ¶
func RegisterMasks ¶
func SortByScore ¶
func SortByScore[T any](files ScoredFiles[T])
func Traverse ¶
func Traverse(wfn fs.WalkDirFunc, opts *Options)
Traverse traverses directories non-recursively and breadth first.
func TraverseZip ¶
func TraverseZip(path string, depth int, wfn fs.WalkDirFunc, opts *Options)
Types ¶
type FilterOpts ¶
type FilterOpts struct { Search []string `` /* 170-byte string literal not displayed */ SearchAnd bool `` /* 136-byte string literal not displayed */ Include []string `short:"i" long:"include" description:"File type inclusion: image, video, audio. Can be used multiple times."` Exclude []string `short:"e" long:"exclude" description:"File type exclusion: image, video, audio. Can be used multiple times."` Ignore []string `short:"I" long:"ignore" description:"Ignores all paths which include any given strings."` DirOnly bool `long:"dirs" description:"Only include directories in the result."` FileOnly bool `long:"files" description:"Only include files in the result."` }
type ListingOpts ¶
type ListingOpts struct { Recurse bool `` /* 139-byte string literal not displayed */ Archive bool `short:"z" description:"Treat zip archives as directories."` ToDepth int `short:"T" long:"todepth" description:"List files to a certain depth." default:"0"` FromDepth int `short:"F" long:"fromdepth" description:"List files from a certain depth." default:"-1"` }
type Options ¶
type Options struct { ListingOpts `group:"Traversal options - Determines how the traversal is done."` FilterOpts `group:"Filtering options - Applied while traversing, called on every entry found."` ProcessOpts `group:"Processing options - Applied after traversal, called on the final list of files."` Printing `group:"Printing options - Determines how the results are printed."` Args []string }
type Printing ¶
type Printing struct { Absolute bool `short:"A" long:"absolute" description:"Format paths to be absolute. Relative by default."` Debug bool `short:"D" long:"debug" description:"Debug flag enables debug logging."` Quiet bool `short:"Q" long:"quiet" description:"Quiet flag disables printing results."` Clipboard bool `short:"c" long:"clipboard" description:"Copy the result to the clipboard."` Tree bool `long:"tree" description:"Prints as tree."` }
type Process ¶
func CollectProcess ¶
func QueryProcess ¶
func ShuffleProcess ¶
func SliceProcess ¶
func SortProcess ¶
type ProcessOpts ¶
type ProcessOpts struct { Query []string `short:"q" long:"query" description:"Fuzzy search query. Results will be ordered by their score."` Ascending bool `` /* 136-byte string literal not displayed */ Sort string `` /* 206-byte string literal not displayed */ Select string `` /* 183-byte string literal not displayed */ Shuffle bool `long:"shuffle" description:"Randomly shuffle the result."` Seed int64 `long:"seed" description:"Seed for the random shuffle." default:"-1"` }
type ScoredFiles ¶
type ScoredFiles[T any] []scored[T]
func (ScoredFiles[T]) Items ¶
func (s ScoredFiles[T]) Items() []T
Items returns all T with a score above 0.
type TreeNode ¶
type TreeNode struct {
// contains filtered or unexported fields
}
func AddFilesToTree ¶
func NewTreeNode ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.