command

package module
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 6 Imported by: 0

README

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Find

func Find(root gloo.File, opts ...any) gloo.Source[[]byte]

Find returns a Source that walks the tree rooted at root on the configured filesystem and emits the path of every entry that passes the active filters.

Options (each folded into the run's flags):

  • FindFs{Fs: fs}: filesystem to walk (default: the OS filesystem)
  • FindName(glob): keep entries whose base name matches glob (GNU -name)
  • FindType("f"/"d"): keep only files or only directories (GNU -type)
  • FindMaxDepth(n): descend at most n levels below the root (GNU -maxdepth)

Types

type FindFs

type FindFs struct{ Fs afero.Fs }

FindFs injects the filesystem a find run walks. Production omits it and the real OS filesystem is used; tests pass FindFs{Fs: afero.NewMemMapFs()} for hermetic, 100%-coverable runs. This is the dependency-injection seam for the whole module.

type FindMaxDepth

type FindMaxDepth int

FindMaxDepth limits the walk to entries at most n levels below the root (GNU -maxdepth). The root itself is depth 0.

type FindName

type FindName string

FindName filters entries whose base name matches the glob pattern, GNU -name style (filepath.Match). The empty pattern matches every entry.

type FindType

type FindType string

FindType restricts results to a single entry kind (GNU -type): "f" for files, "d" for directories. Any other value imposes no restriction. Prefer the FindTypeFile / FindTypeDir constants.

const (
	// FindTypeFile keeps only regular files (-type f).
	FindTypeFile FindType = "f"
	// FindTypeDir keeps only directories (-type d).
	FindTypeDir FindType = "d"
)

Directories

Path Synopsis
Package alias provides unprefixed names for the find command and its flags.
Package alias provides unprefixed names for the find command and its flags.

Jump to

Keyboard shortcuts

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