Documentation
¶
Index ¶
- Variables
- func All() ([]action.AnyStreamAction, []action.NamedOperator)
- func ClipboardOperator() action.NamedOperator
- func ClipboardWrite[T any](cfg ClipboardConfig) action.StreamOp[T, T]
- func Filter(cfg FilterConfig) action.StreamOp[FileMeta, FileMeta]
- func FilterOperator() action.NamedOperator
- func GenerateStatsSummary(entries []StatEntry, maxDepth int) string
- func Library() action.Library
- func OutFile[T any](cfg OutFileConfig) action.StreamOp[T, T]
- func OutFileOperator() action.NamedOperator
- func Read(cfg ReadConfig) action.StreamOp[FileMeta, FileContent]
- func ReadOperator() action.NamedOperator
- func RenderMarkdown(cfg RenderConfig) action.StreamOp[FileContent, FileContent]
- func RenderMarkdownOperator() action.NamedOperator
- func Sort(cfg SortConfig) action.StreamOp[FileMeta, FileMeta]
- func SortOperator() action.NamedOperator
- func Stdout(up iter.Seq2[FileMeta, error]) iter.Seq2[FileMeta, error]
- func StdoutOperator() action.NamedOperator
- func WalkSource() action.AnyStreamAction
- type ClipboardConfig
- type FileContent
- type FileMeta
- type FilterConfig
- type OutFileConfig
- type ReadConfig
- type RenderConfig
- type SortConfig
- type StatEntry
- type WalkConfig
- type WalkReq
Constants ¶
This section is empty.
Variables ¶
var BinaryExtensions = map[string]bool{ ".exe": true, ".dll": true, ".so": true, ".dylib": true, ".bin": true, ".obj": true, ".o": true, ".a": true, ".png": true, ".jpg": true, ".jpeg": true, ".gif": true, ".ico": true, ".webp": true, ".pdf": true, ".zip": true, ".tar": true, ".gz": true, ".7z": true, ".db": true, ".sqlite": true, ".sqlite3": true, ".pyc": true, ".pyo": true, ".wasm": true, }
var DefaultSkipDirs = []string{
".git",
"node_modules",
"vendor",
"target",
"dist",
"build",
"_srcpack",
".next",
".turbo",
".cache",
".idea",
".vscode",
}
Functions ¶
func All ¶
func All() ([]action.AnyStreamAction, []action.NamedOperator)
func ClipboardOperator ¶
func ClipboardOperator() action.NamedOperator
func ClipboardWrite ¶
func ClipboardWrite[T any](cfg ClipboardConfig) action.StreamOp[T, T]
func FilterOperator ¶
func FilterOperator() action.NamedOperator
func GenerateStatsSummary ¶
func OutFileOperator ¶
func OutFileOperator() action.NamedOperator
func Read ¶
func Read(cfg ReadConfig) action.StreamOp[FileMeta, FileContent]
func ReadOperator ¶
func ReadOperator() action.NamedOperator
func RenderMarkdown ¶
func RenderMarkdown(cfg RenderConfig) action.StreamOp[FileContent, FileContent]
func RenderMarkdownOperator ¶
func RenderMarkdownOperator() action.NamedOperator
func SortOperator ¶
func SortOperator() action.NamedOperator
func StdoutOperator ¶
func StdoutOperator() action.NamedOperator
func WalkSource ¶
func WalkSource() action.AnyStreamAction
WalkSource creates a stream source for file metadata traversal.
Traversal rules, in order:
- Hidden entries (name starting with ".") are skipped unless IncludeHidden is true. The rule applies to files and directories alike, so .hidden.go and .hidden/ are treated the same way.
- Directories named in DefaultSkipDirs, or in Skip, are skipped unless IncludeAll is true.
- Entries at depth >= MaxDepth are not descended into; entries deeper than MaxDepth are not yielded.
- Files with an extension in BinaryExtensions are skipped.
- When Ext is set, only files matching one of its extensions are yielded.
The source stops cleanly when the downstream yield returns false, when the context is cancelled, or when it has exhausted its target directories.
Types ¶
type ClipboardConfig ¶
type ClipboardConfig struct {
Enabled bool `json:"enabled"`
}
type FileContent ¶
type FileMeta ¶
type FileMeta struct {
Path string `json:"path"`
RelPath string `json:"rel_path"`
Size int64 `json:"size"`
ModTime time.Time `json:"mod_time"`
Lang string `json:"lang"`
}
FileMeta is the item type that flows through the fsio pipeline.
type FilterConfig ¶
type OutFileConfig ¶
type ReadConfig ¶
type ReadConfig struct {
Lines string `json:"lines"`
}
type RenderConfig ¶
type SortConfig ¶
type WalkConfig ¶
type WalkConfig struct {
Dir string `json:"dir" cli:"dir,d"`
Dirs []string `json:"dirs" cli:"dirs"`
Files []string `json:"files" cli:"files,file,f"`
Skip []string `json:"skip" cli:"skip"`
IncludeHidden bool `json:"include_hidden" cli:"include_hidden"`
IncludeAll bool `json:"include_all" cli:"include_all"`
Ext string `json:"ext" cli:"ext"`
MaxDepth int `json:"max_depth" cli:"max_depth"`
}
WalkConfig contains strongly-typed parameters for filesystem traversal.
IncludeHidden defaults to false, so hidden files and directories are skipped unless the caller explicitly opts in. The zero value is the safe choice: no accidental traversal of .git internals, .env files, editor swap files, or hidden build artefacts. Set IncludeHidden: true to traverse them.
IncludeAll disables the DefaultSkipDirs blacklist. It is independent of IncludeHidden: a caller can include vendor/ without including .git, and vice versa.
type WalkReq ¶
type WalkReq = WalkConfig
WalkReq is an alias to WalkConfig for callers that used the older name. Kept deliberately: a rename with no behavioural difference does not warrant churning every call site.