util

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package util is the plumbing the file tools share: paths, walking, globs, and search results.

Index

Constants

View Source
const MaxMatches = 100

MaxMatches caps what a search hands back.

Variables

This section is empty.

Functions

func MatchGlob

func MatchGlob(pattern string, name string) bool

MatchGlob reports whether name, a slash-separated relative path, matches pattern. '*', '?' and '[...]' are path.Match within one segment, and '**' as a whole segment matches zero or more of them.

func RenderSearch

func RenderSearch(pattern string, path string, globPattern string) (string, string)

RenderSearch describes a search out loud, as the pattern and what qualifies it. A search taking no glob passes an empty string, and the working directory goes without saying.

func Report

func Report(matches []string, truncated bool) string

Report renders what a search found, saying so where the cap was hit.

func RootName

func RootName(root *file.Root, path string) (string, error)

RootName turns a tool-supplied path into the relative name Root's own methods take. It rejects a name that plainly leaves the root; Root re-validates the name when it is opened.

func SearchPath

func SearchPath(call tool.Call) string

SearchPath returns the final component of the path in a rendered search call.

func Walk

func Walk(filesystem fs.FS, root string, visit func(path string, entry fs.DirEntry) error) error

Walk visits every entry below root within filesystem, skipping symlinks and the directories nothing wants searched.

Types

This section is empty.

Jump to

Keyboard shortcuts

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