Documentation ¶
Index ¶
- Constants
- Variables
- func FileIsBuildFile(path string) bool
- func FindWorkspaceFile(ctx context.Context, inputPath string) (string, error)
- func GetImportedCommand(args []string) string
- func GetPackageFromFile(filePath string, rootPath string) (string, error)
- func HasCommandToImport(args []string) bool
- type BuildFile
- type ErrCommand
- type ErrInvalidQuery
- type Label
- type Node
- type Query
- func (q *Query) GenComp(ctx context.Context, prefix string) (string, error)
- func (q *Query) GetFileByLabel(label Label) *BuildFile
- func (q *Query) QueryFilesByPrefix(ctx context.Context, prefix string) ([]*BuildFile, error)
- func (w *Query) QueryTargetsByFile(ctx context.Context, filePath string) ([]string, error)
- func (q *Query) Update(ctx context.Context, depth int) error
- type Workspace
- func (w *Workspace) Clean(ctx context.Context, label string) error
- func (w *Workspace) GetInfo(ctx context.Context, target string) (string, error)
- func (w *Workspace) Import(ctx context.Context, target string, args []string) error
- func (w *Workspace) Init(ctx context.Context) error
- func (w *Workspace) RunTarget(ctx context.Context, target string) error
Constants ¶
const BuildDir = "build-out"
const RootLabel = "//"
Variables ¶
var ErrNoMakefileFound = errors.New("no Makefile found")
var ErrNoWorkspaceFound = errors.New("no WORKSPACE.mmake file found")
var ErrTargetExists = errors.New("target already exists")
Functions ¶
func FileIsBuildFile ¶
func FindWorkspaceFile ¶
FindWorkspaceFile finds the WORKSPACE.mmake relative to the current directory if a path is specified, it will search relative to that path. If the path is a WORKSPACE.mmake file, it will return that path.
func GetImportedCommand ¶ added in v0.5.0
func HasCommandToImport ¶ added in v0.5.0
HasCommandToImport returns true if the args contain a command to import a target e.g. mmake //services/api:api -- go run ./services/api will return true.
Types ¶
type BuildFile ¶
type BuildFile struct { // path to the build file Path string // label of the build file Label Label // list of targets in the build file Targets []string // the description of the build file (if any) Description string }
func CreateBuildFile ¶ added in v0.5.0
func (*BuildFile) CreateTarget ¶ added in v0.5.0
CreateTarget creates a new target in the build file using the reader as the content of the target if the target already exists, then it will throw an error. opens a file handle to the build file.
type ErrCommand ¶
type ErrCommand struct {
Err error
}
func (*ErrCommand) Error ¶
func (e *ErrCommand) Error() string
func (*ErrCommand) Unwrap ¶
func (e *ErrCommand) Unwrap() error
type ErrInvalidQuery ¶
type ErrInvalidQuery struct {
// contains filtered or unexported fields
}
func (*ErrInvalidQuery) Error ¶
func (e *ErrInvalidQuery) Error() string
type Node ¶
type Node struct { Children []*Node // contains filtered or unexported fields }
func (*Node) GetDeepestParent ¶
func (*Node) GetTreeAsList ¶
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
func (*Query) GenComp ¶
GenComp completes the given prefix to a list of files and targets that match the prefix if there is a ':' in the input, it will complete to targets, otherwise it will complete to files. TODO: move this to the 'completion' package. TODO: use the tree structure to pick a subtree. Should be faster.
func (*Query) GetFileByLabel ¶
func (*Query) QueryFilesByPrefix ¶
QueryByPrefix returns a list of workspace-aware files that match the given prefix
func (*Query) QueryTargetsByFile ¶
QueryTargetsByFile returns a list of targets that are contained within the given file