project

package
v3.2.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterCodeBlocks

func FilterCodeBlocks[T FileCodeBlock](blocks []T, allowUnknown bool, allowUnnamed bool) (result []T)

func Format

func Format(files []string, basePath string, flatten bool, formatJSON bool, write bool, outputter funcOutput) error

func GetCodeBlocks

func GetCodeBlocks(filepath string, fs billy.Basic) (document.CodeBlocks, error)

func GetCodeBlocksAndParseFrontmatter

func GetCodeBlocksAndParseFrontmatter(filepath string, fs billy.Basic) (document.CodeBlocks, document.Frontmatter, error)

func IsCodeBlockNotFoundError

func IsCodeBlockNotFoundError(err error) bool

func LoadProjectFiles

func LoadProjectFiles(proj Project) ([]string, error)

Load files, blocking until all projects are loaded

func ReadMarkdownFile

func ReadMarkdownFile(filepath string, fs billy.Basic) ([]byte, error)

func WriteMarkdownFile

func WriteMarkdownFile(filename string, fs billy.Basic, data []byte) error

Types

type CodeBlock

type CodeBlock struct {
	Block *document.CodeBlock
	/// Relative to `project.Root()`
	File        string
	Frontmatter document.Frontmatter
	// contains filtered or unexported fields
}

func (CodeBlock) Clone

func (b CodeBlock) Clone() *CodeBlock

func (CodeBlock) GetBlock

func (b CodeBlock) GetBlock() *document.CodeBlock

func (CodeBlock) GetFile

func (b CodeBlock) GetFile() string

func (CodeBlock) GetFileRel

func (b CodeBlock) GetFileRel() string

func (CodeBlock) GetFrontmatter

func (b CodeBlock) GetFrontmatter() document.Frontmatter

func (CodeBlock) GetID

func (b CodeBlock) GetID() string

type CodeBlockFS

type CodeBlockFS interface {
	billy.Basic
	billy.Chroot
}

type CodeBlocks

type CodeBlocks []CodeBlock

func LoadProjectTasks

func LoadProjectTasks(proj Project) (CodeBlocks, error)

Load tasks, blocking until all projects are loaded

func (CodeBlocks) Lookup

func (blocks CodeBlocks) Lookup(queryName string) []CodeBlock

func (CodeBlocks) LookupByFile

func (blocks CodeBlocks) LookupByFile(queryFile string) ([]CodeBlock, error)

func (CodeBlocks) LookupByID

func (blocks CodeBlocks) LookupByID(query string) ([]CodeBlock, error)

func (CodeBlocks) LookupWithFile

func (blocks CodeBlocks) LookupWithFile(queryFile string, queryName string) ([]CodeBlock, error)

func (CodeBlocks) Names

func (blocks CodeBlocks) Names() []string

type DirectoryProject

type DirectoryProject struct {
	// contains filtered or unexported fields
}

func NewDirectoryProject

func NewDirectoryProject(dir string, findNearestRepo bool, allowUnknown bool, allowUnnamed bool, ignorePatterns []string) (*DirectoryProject, error)

func (*DirectoryProject) Dir

func (p *DirectoryProject) Dir() string

func (*DirectoryProject) EnvLoadOrder

func (p *DirectoryProject) EnvLoadOrder() []string

func (*DirectoryProject) LoadEnvs

func (p *DirectoryProject) LoadEnvs() (map[string]string, error)

func (*DirectoryProject) LoadTasks

func (p *DirectoryProject) LoadTasks(filesOnly bool, channel chan<- interface{})

func (*DirectoryProject) SetEnvLoadOrder

func (p *DirectoryProject) SetEnvLoadOrder(envLoadOrder []string)

func (*DirectoryProject) SetRespectGitignore

func (p *DirectoryProject) SetRespectGitignore(respectGitignore bool)

type DirectoryProjectMatcher

type DirectoryProjectMatcher struct {
	// contains filtered or unexported fields
}

TODO(mxs): support `.runmeignore` file

func (*DirectoryProjectMatcher) Match

func (m *DirectoryProjectMatcher) Match(path []string, isDir bool) bool

type ErrCodeBlockFileNotFound

type ErrCodeBlockFileNotFound struct {
	// contains filtered or unexported fields
}

func (ErrCodeBlockFileNotFound) Error

func (e ErrCodeBlockFileNotFound) Error() string

func (ErrCodeBlockFileNotFound) FailedFileQuery

func (e ErrCodeBlockFileNotFound) FailedFileQuery() string

type ErrCodeBlockNameNotFound

type ErrCodeBlockNameNotFound struct {
	// contains filtered or unexported fields
}

func (ErrCodeBlockNameNotFound) Error

func (e ErrCodeBlockNameNotFound) Error() string

func (ErrCodeBlockNameNotFound) FailedNameQuery

func (e ErrCodeBlockNameNotFound) FailedNameQuery() string

type FileCodeBlock

type FileCodeBlock interface {
	GetBlock() *document.CodeBlock

	// relative to project root
	GetFileRel() string

	// absolute file path
	GetFile() string
	GetFrontmatter() document.Frontmatter
}

type LoadTaskError

type LoadTaskError struct {
	Err error
}

type LoadTaskFoundFile

type LoadTaskFoundFile struct {
	Filename string
}

type LoadTaskFoundTask

type LoadTaskFoundTask struct {
	Task CodeBlock
}

type LoadTaskParsingFile

type LoadTaskParsingFile struct {
	Filename string
}

type LoadTaskSearchingFolder

type LoadTaskSearchingFolder struct {
	Folder string
}

type LoadTaskStatusParsingFiles

type LoadTaskStatusParsingFiles struct{}

type LoadTaskStatusSearchingFiles

type LoadTaskStatusSearchingFiles struct{}

type Project

type Project interface {
	// Loads tasks in project, sending details to provided channel. Will block, but is thread-safe.
	//
	// Received messages for the channel will be of type `project.LoadTask*`. The
	// channel will be closed on finish or error.
	//
	// Use `filesOnly` to just find files, skipping markdown parsing
	LoadTasks(filesOnly bool, channel chan<- interface{})
	LoadEnvs() (map[string]string, error)
	EnvLoadOrder() []string
	Dir() string
}

type ProjectLoader

type ProjectLoader struct {
	// contains filtered or unexported fields
}

func NewLoader

func NewLoader(w io.Writer, r io.Reader, isTerminal bool) ProjectLoader

func (ProjectLoader) LoadFiles

func (pl ProjectLoader) LoadFiles(proj Project) ([]string, error)

func (ProjectLoader) LoadTasks

func (pl ProjectLoader) LoadTasks(proj Project, allowUnknown bool, allowUnnamed bool, filter bool) (CodeBlocks, error)

type SingleFileProject

type SingleFileProject struct {
	// contains filtered or unexported fields
}

func NewSingleFileProject

func NewSingleFileProject(file string, allowUnknown bool, allowUnnamed bool) *SingleFileProject

func (*SingleFileProject) Dir

func (p *SingleFileProject) Dir() string

func (*SingleFileProject) EnvLoadOrder

func (p *SingleFileProject) EnvLoadOrder() []string

func (*SingleFileProject) LoadEnvs

func (p *SingleFileProject) LoadEnvs() (map[string]string, error)

func (*SingleFileProject) LoadTasks

func (p *SingleFileProject) LoadTasks(filesOnly bool, channel chan<- interface{})

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL