Documentation ¶
Index ¶
- Variables
- func ExtractDataFromLoadEvent[T any](event LoadEvent) T
- func FormatFiles(files []string, flatten bool, formatJSON bool, write bool, ...) error
- func GetRelativePath(cwd, path string) string
- func LoadFiles(ctx context.Context, p *Project) ([]string, error)
- func SortByProximity(tasks []Task, cwd string)
- type Filter
- type FuncOutput
- type LoadEvent
- type LoadEventErrorData
- type LoadEventFinishedParsingDocumentData
- type LoadEventFinishedWalkData
- type LoadEventFoundDirData
- type LoadEventFoundFileData
- type LoadEventFoundTaskData
- type LoadEventStartedParsingDocumentData
- type LoadEventStartedWalkData
- type LoadEventType
- type LoadOptions
- type Matcher
- type Project
- func (p *Project) EnvFilesReadOrder() []string
- func (p *Project) Load(ctx context.Context, eventc chan<- LoadEvent, onlyFiles bool)
- func (p *Project) LoadEnv() ([]string, error)
- func (p *Project) LoadEnvAsMap() (map[string]string, error)
- func (p *Project) LoadEnvWithSource() (envWithSource map[string]map[string]string, err error)
- func (p *Project) LoadRawEnv(file string) ([]byte, error)
- func (p *Project) LoadWithOptions(ctx context.Context, eventc chan<- LoadEvent, options LoadOptions)
- func (p *Project) Root() string
- type ProjectOption
- type Task
- func FilterTasksByExactTaskName(tasks []Task, name string) (result []Task, err error)
- func FilterTasksByFilename(tasks []Task, expr string) (result []Task, err error)
- func FilterTasksByFn(tasks []Task, fns ...Filter) (result []Task, err error)
- func FilterTasksByID(tasks []Task, expr string) (result []Task, err error)
- func LoadTasks(ctx context.Context, p *Project) ([]Task, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultProjectOptions = [...]ProjectOption{ WithFindRepoUpward(), WithRespectGitignore(true), WithEnvFilesReadOrder([]string{".env"}), WithIgnoreFilePatterns("node_modules", ".venv", "vendor"), }
View Source
var ErrReturnEarly = errors.New("return early")
Functions ¶
func ExtractDataFromLoadEvent ¶ added in v3.4.1
func FormatFiles ¶ added in v3.4.1
func GetRelativePath ¶ added in v3.6.2
func SortByProximity ¶ added in v3.6.2
SortByProximity sorts tasks by promximity to the cwd
Types ¶
type FuncOutput ¶ added in v3.4.1
type LoadEvent ¶ added in v3.4.1
type LoadEvent struct { Type LoadEventType Data any }
type LoadEventErrorData ¶ added in v3.4.1
type LoadEventErrorData struct {
Err error
}
type LoadEventFinishedParsingDocumentData ¶ added in v3.4.1
type LoadEventFinishedParsingDocumentData struct {
Path string
}
type LoadEventFinishedWalkData ¶ added in v3.4.1
type LoadEventFinishedWalkData struct{}
type LoadEventFoundDirData ¶ added in v3.4.1
type LoadEventFoundDirData struct {
Path string
}
type LoadEventFoundFileData ¶ added in v3.4.1
type LoadEventFoundFileData struct {
Path string
}
type LoadEventFoundTaskData ¶ added in v3.4.1
type LoadEventFoundTaskData struct {
Task Task
}
type LoadEventStartedParsingDocumentData ¶ added in v3.4.1
type LoadEventStartedParsingDocumentData struct {
Path string
}
type LoadEventStartedWalkData ¶ added in v3.4.1
type LoadEventStartedWalkData struct{}
type LoadEventType ¶ added in v3.4.1
type LoadEventType uint8
const ( LoadEventStartedWalk LoadEventType = iota + 1 LoadEventFoundDir LoadEventFoundFile LoadEventFinishedWalk LoadEventStartedParsingDocument LoadEventFinishedParsingDocument LoadEventFoundTask LoadEventError )
type LoadOptions ¶ added in v3.4.1
type LoadOptions struct {
OnlyFiles bool
}
type Matcher ¶ added in v3.4.1
func CompileRegex ¶ added in v3.4.1
type Project ¶
type Project struct {
// contains filtered or unexported fields
}
func NewDirProject ¶ added in v3.4.1
func NewDirProject( dir string, opts ...ProjectOption, ) (*Project, error)
func NewFileProject ¶ added in v3.4.1
func NewFileProject( path string, opts ...ProjectOption, ) (*Project, error)
func (*Project) EnvFilesReadOrder ¶ added in v3.4.1
func (*Project) LoadEnvAsMap ¶ added in v3.4.1
func (*Project) LoadEnvWithSource ¶ added in v3.4.1
func (*Project) LoadRawEnv ¶ added in v3.4.1
func (*Project) LoadWithOptions ¶ added in v3.4.1
func (p *Project) LoadWithOptions( ctx context.Context, eventc chan<- LoadEvent, options LoadOptions, )
type ProjectOption ¶ added in v3.4.1
type ProjectOption func(*Project)
func WithEnvFilesReadOrder ¶ added in v3.4.1
func WithEnvFilesReadOrder(order []string) ProjectOption
func WithFindRepoUpward ¶ added in v3.4.1
func WithFindRepoUpward() ProjectOption
func WithIgnoreFilePatterns ¶ added in v3.4.1
func WithIgnoreFilePatterns(patterns ...string) ProjectOption
func WithLogger ¶ added in v3.4.1
func WithLogger(logger *zap.Logger) ProjectOption
func WithRespectGitignore ¶ added in v3.4.1
func WithRespectGitignore(value bool) ProjectOption
type Task ¶ added in v3.4.1
type Task struct { CodeBlock *document.CodeBlock `json:"code_block"` DocumentPath string `json:"document_path"` RelDocumentPath string `json:"rel_document_path"` }
Task is struct representing a document.CodeBlock within the context of a project. Instance of document.Document can be retrieved from Task's code block. Task contains absolute and relative path to the document.
func FilterTasksByExactTaskName ¶ added in v3.4.1
func FilterTasksByFilename ¶ added in v3.4.1
func FilterTasksByFn ¶ added in v3.4.1
func FilterTasksByID ¶ added in v3.4.1
Click to show internal directories.
Click to hide internal directories.