codebase

package
v0.0.0-...-75e9695 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NotFoundError = errors.New("not found")

Functions

This section is empty.

Types

type Codebase

type Codebase interface {
	// FindFileMatching returns the path of the first file it finds matching a `glob`
	// and for which predicate returns true.
	// Note by go standard library doesn't understand globs with double asterisks,
	// like "/**/project.clj"
	FindFileMatching(predicate func(path string) bool, glob ...string) (path string, err error)
	// FindFile is like FindFileMatching, but with a constantly true predicate, so it always
	// returns the first file that matches glob
	FindFile(glob ...string) (path string, err error)
	ReadFile(path string) (contents []byte, err error)
}

Codebase interface that allows finding files in a codebase and reading file contents

type LocalCodebase

type LocalCodebase struct {
	BasePath string
	// contains filtered or unexported fields
}

LocalCodebase is a Codebase for files available on local disk

func (LocalCodebase) FindFile

func (c LocalCodebase) FindFile(glob ...string) (path string, err error)

func (LocalCodebase) FindFileMatching

func (c LocalCodebase) FindFileMatching(
	predicate func(string) bool,
	glob ...string,
) (string, error)

func (LocalCodebase) ReadFile

func (c LocalCodebase) ReadFile(path string) (contents []byte, err error)

Jump to

Keyboard shortcuts

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