Documentation
¶
Overview ¶
Package gofd is a pure-Go port of the `fd` file finder. It exposes a friendly SDK for embedding fd-style search in Go programs, while cmd/fd provides a CLI compatible with the original tool.
Typical SDK usage:
results, err := gofd.Find(context.Background(), gofd.Options{
Pattern: "\\.go$",
Paths: []string{"."},
})
Index ¶
Constants ¶
View Source
const ( ExitSuccess = finder.ExitSuccess ExitGeneralError = finder.ExitGeneralError )
Process exit codes.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
// Pattern is the primary search pattern. Empty matches everything.
Pattern string
// Exprs are additional patterns that must all match (fd's --and).
Exprs []string
// Paths are the search roots. Defaults to the current directory.
Paths []string
// Pattern interpretation.
Glob bool // treat patterns as globs
FixedStrings bool // treat patterns as literal substrings
Exact bool // match the whole filename literally
// Case handling. By default smart-case is used.
CaseSensitive bool
IgnoreCase bool
// Path matching.
FullPath bool // match against the full path, not just the file name
AbsolutePath bool // emit absolute paths
// Ignore handling.
Hidden bool // include hidden files
NoIgnore bool // disable all ignore files
NoIgnoreVcs bool // disable .gitignore only
NoIgnoreParent bool // disable ignore files in parent directories
NoGlobalIgnore bool // disable the global ignore file
NoRequireGit bool // respect gitignore even outside a git repo
Unrestricted bool // alias for NoIgnore + Hidden
// Traversal.
FollowLinks bool
OneFileSystem bool
MaxDepth int // 0 = unlimited
MinDepth int // 0 = none
ExactDepth int // 0 = unset; sets both min and max
Prune bool
Threads int // 0 = auto
// Filters.
Types []string // f,d,l,x,e,s,p,c,b (or long names)
Extensions []string
Exclude []string
Sizes []string // e.g. "+1m", "-500k"
ChangedWithin string
ChangedBefore string
Owner string // [user|uid][:group|gid]
IgnoreFiles []string
IgnoreContain []string
// Output.
NullSeparator bool
PathSeparator string
MaxResults int // 0 = unlimited
Format string
StripCwdPrefix *bool // nil = auto
// Color: "auto", "always", "never".
Color string
Hyperlink string // "auto", "always", "never"
// Command execution (mutually exclusive with Format/output).
Exec []string // -x command template (terminated logically by caller)
ExecBatch []string // -X command template
BatchSize int
ShowErrors bool
Quiet bool
// ListDetails emulates --list-details (ls -l style listing).
ListDetails bool
}
Options is the high-level, user-facing configuration for a search. Sensible fd defaults (smart case, respecting ignore files, skipping hidden entries) are applied automatically.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
fd
command
Command fd is a Go port of the `fd` file finder.
|
Command fd is a Go port of the `fd` file finder. |
|
pkg
|
|
|
exec
Package exec implements fd's command execution feature (-x/--exec and -X/--exec-batch), including placeholder substitution and batching.
|
Package exec implements fd's command execution feature (-x/--exec and -X/--exec-batch), including placeholder substitution and batching. |
|
filter
Package filter implements the result filters used by fd: size, modification time and (on unix) ownership constraints.
|
Package filter implements the result filters used by fd: size, modification time and (on unix) ownership constraints. |
|
finder
Package finder is the core engine of go-fd.
|
Package finder is the core engine of go-fd. |
|
format
Package format implements fd's format/exec placeholder templates, supporting the tokens {}, {/}, {//}, {.}, {/.} and literal brace escaping ({{ }}).
|
Package format implements fd's format/exec placeholder templates, supporting the tokens {}, {/}, {//}, {.}, {/.} and literal brace escaping ({{ }}). |
|
glob
Package glob translates shell-style glob patterns into Go regular expressions.
|
Package glob translates shell-style glob patterns into Go regular expressions. |
|
ignore
Package ignore implements gitignore-style pattern matching used by fd to honor .gitignore, .ignore, .fdignore and custom ignore files.
|
Package ignore implements gitignore-style pattern matching used by fd to honor .gitignore, .ignore, .fdignore and custom ignore files. |
Click to show internal directories.
Click to hide internal directories.