Documentation
¶
Index ¶
- Variables
- func ExtractDataFromLoadEvent[T any](event LoadEvent) T
- func LoadFiles(ctx context.Context, p *Project) ([]string, error)
- type Filter
- 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) LoadWithOptions(ctx context.Context, eventc chan<- LoadEvent, options LoadOptions)
- func (p *Project) Root() string
- func (p *Project) String() 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 ¶
Types ¶
type LoadEvent ¶
type LoadEvent struct { Type LoadEventType Data any }
type LoadEventErrorData ¶
type LoadEventErrorData struct {
Err error
}
type LoadEventFinishedParsingDocumentData ¶
type LoadEventFinishedParsingDocumentData struct {
Path string
}
type LoadEventFinishedWalkData ¶
type LoadEventFinishedWalkData struct{}
type LoadEventFoundDirData ¶
type LoadEventFoundDirData struct {
Path string
}
type LoadEventFoundFileData ¶
type LoadEventFoundFileData struct {
Path string
}
type LoadEventFoundTaskData ¶
type LoadEventFoundTaskData struct {
Task Task
}
type LoadEventStartedParsingDocumentData ¶
type LoadEventStartedParsingDocumentData struct {
Path string
}
type LoadEventStartedWalkData ¶
type LoadEventStartedWalkData struct{}
type LoadEventType ¶
type LoadEventType uint8
const ( LoadEventStartedWalk LoadEventType = iota + 1 LoadEventFoundDir LoadEventFoundFile LoadEventFinishedWalk LoadEventStartedParsingDocument LoadEventFinishedParsingDocument LoadEventFoundTask LoadEventError )
type LoadOptions ¶
type LoadOptions struct {
OnlyFiles bool
}
type Matcher ¶
func CompileRegex ¶
type Project ¶
type Project struct {
// contains filtered or unexported fields
}
func NewDirProject ¶
func NewDirProject( dir string, opts ...ProjectOption, ) (*Project, error)
func NewFileProject ¶
func NewFileProject( path string, opts ...ProjectOption, ) (*Project, error)
func (*Project) EnvFilesReadOrder ¶
func (*Project) LoadWithOptions ¶
func (p *Project) LoadWithOptions( ctx context.Context, eventc chan<- LoadEvent, options LoadOptions, )
type ProjectOption ¶
type ProjectOption func(*Project)
func WithEnvFilesReadOrder ¶
func WithEnvFilesReadOrder(order []string) ProjectOption
func WithFindRepoUpward ¶
func WithFindRepoUpward() ProjectOption
func WithIgnoreFilePatterns ¶
func WithIgnoreFilePatterns(patterns ...string) ProjectOption
func WithLogger ¶
func WithLogger(logger *zap.Logger) ProjectOption
func WithRespectGitignore ¶
func WithRespectGitignore(value bool) ProjectOption
type Task ¶
Task is a project-specific struct. It's a `document.CodeBlock` with a path to the document it belongs to.
Instance of `Document` can be retrieved from `document.CodeBlock`.
func FilterTasksByFilename ¶
Directories
¶
Path | Synopsis |
---|---|
testutils provides helpers for integration tests with "internal/project" package.
|
testutils provides helpers for integration tests with "internal/project" package. |
Click to show internal directories.
Click to hide internal directories.