Documentation
¶
Index ¶
- Constants
- Variables
- func GitReadArgs(ctx context.Context, runner worktree.StreamingGitRunner, root, command string, ...) ([]string, error)
- func OpenRegularFile(root *os.Root, path string) (*os.File, error)
- func Sensitive(path string) bool
- func ValidatePath(path string) error
- type Content
- type ContentKind
- type Entry
- type EntryKind
- type FileReader
- type FileSearch
- type FindMatch
- type FindResult
- type Finder
- type GitStatus
- type ListOptions
- type Listing
- type Option
- type ReadOptions
- type Reader
- type Root
- type RootKind
- type RootRef
- type RootResolver
- type SearchFile
- type SearchMatch
- type SearchQuery
- type SearchResult
- type Searcher
Constants ¶
View Source
const ( TextLimit = 1 << 20 ImageLimit = 5 << 20 EntryLimit = 5000 )
View Source
const FindIndexLimit = 200000
Variables ¶
View Source
var ( ErrInvalidPath = errors.New("projectfiles: invalid path") ErrPathOutsideRoot = errors.New("projectfiles: path outside root") ErrPathDenied = errors.New("projectfiles: path denied") ErrNotFound = errors.New("projectfiles: not found") ErrNotADirectory = errors.New("projectfiles: not a directory") ErrNotAFile = errors.New("projectfiles: not a file") ErrRootNotFound = errors.New("projectfiles: root not found") )
View Source
var ErrInvalidQuery = errors.New("projectfiles: invalid query")
Functions ¶
func GitReadArgs ¶
func GitReadArgs( ctx context.Context, runner worktree.StreamingGitRunner, root, command string, args ...string, ) ([]string, error)
GitReadArgs applies the shared read-only policy, discovering filter drivers afresh on each call.
func OpenRegularFile ¶
OpenRegularFile confines the open and rejects special descriptors even after a path swap.
func ValidatePath ¶
Types ¶
type ContentKind ¶
type ContentKind string
const ( ContentKindText ContentKind = "text" ContentKindImage ContentKind = "image" ContentKindBinary ContentKind = "binary" ContentKindSensitive ContentKind = "sensitive" )
type FileReader ¶
type FileReader struct {
// contains filtered or unexported fields
}
func NewReader ¶
func NewReader(opts ...Option) *FileReader
func (*FileReader) List ¶
func (r *FileReader) List(ctx context.Context, root Root, dir string, opts ListOptions) (listing Listing, err error)
func (*FileReader) Read ¶
func (r *FileReader) Read(ctx context.Context, root Root, path string, opts ReadOptions) (content Content, err error)
type FileSearch ¶
type FileSearch struct {
// contains filtered or unexported fields
}
func NewSearch ¶
func NewSearch(runner worktree.StreamingGitRunner, opts ...workspacefiles.Option) *FileSearch
func (*FileSearch) Find ¶
func (s *FileSearch) Find(ctx context.Context, root Root, query string, limit int) (FindResult, error)
func (*FileSearch) Search ¶
func (s *FileSearch) Search(ctx context.Context, root Root, q SearchQuery) (SearchResult, error)
type FindResult ¶
type ListOptions ¶
type ListOptions struct{ ShowIgnored, Refresh bool }
type Option ¶
type Option func(*FileReader)
func WithGitRunner ¶
func WithGitRunner(runner worktree.StreamingGitRunner) Option
func WithStatusTTL ¶
WithStatusTTL sets status retention; zero disables retention while keeping coalescing.
type ReadOptions ¶
type ReadOptions struct{ Reveal bool }
type Root ¶
func CanonicalRoot ¶
type SearchFile ¶
type SearchFile struct {
Path string
Matches []SearchMatch
TruncatedMatches bool
}
type SearchMatch ¶
type SearchQuery ¶
type SearchResult ¶
type SearchResult struct {
Files []SearchFile
TotalFiles, TotalMatches int
Truncated, TimedOut bool
SensitiveExcluded int
Engine string
}
type Searcher ¶
type Searcher interface {
Search(context.Context, Root, SearchQuery) (SearchResult, error)
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.