filereader

package
v0.0.0-...-ef927d8 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyPath         = errors.New("path is empty string")
	ErrPathNotAFile      = errors.New("the path is not a file")
	ErrReachedRoot       = errors.New("we reached the root without finding a .git file or folder")
	ErrParseRepoPath     = errors.New("failed to parse repository path")
	ErrParseBareRepoPath = errors.New("failed to parse bare repository path")
)

Functions

This section is empty.

Types

type FileReader

type FileReader struct {
	Reader Reader
}

func New

func New() FileReader

New creates a new FileReader.

func (FileReader) GitFile

func (f FileReader) GitFile(absolutePath string) (pulse.GitFile, error)

GitFile returns a GitFile struct from an absolute path. It will return an error if the path is empty, if the path is not a file or if it can't find a parent .git file or folder before it reaches the root of the file tree.

type Reader

type Reader interface {
	Dir(string) string
	ReadDir(string) ([]fs.DirEntry, error)
	ReadFile(string) ([]byte, error)
	IsFile(string) bool
}

Reader is an interface for the underlying reader. It is an abstraction to allow for easier testing.

Jump to

Keyboard shortcuts

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