files

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileAlreadyExistsError

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

func NewFileAlreadyExistsError

func NewFileAlreadyExistsError(path string) *FileAlreadyExistsError

func (FileAlreadyExistsError) Error

func (e FileAlreadyExistsError) Error() string

type FileManager

type FileManager interface {
	CreateFile(ctx context.Context, fs afero.Fs, path, content string) (*model.File, error)
	ReadFile(ctx context.Context, fs afero.Fs, path string) (*model.File, error)
	UpdateFile(ctx context.Context, fs afero.Fs, path, content string) (*model.File, error)
	DeleteFile(ctx context.Context, fs afero.Fs, path string) error
	ListFiles(ctx context.Context, fs afero.Fs, opts ...ListFileOption) ([]*model.File, error)
	ApplyPatch(ctx context.Context, fs afero.Fs, path, patch string) (*model.File, error)
	UpdateLines(ctx context.Context, fs afero.Fs, path string, lineDiff LineDiffChunk) (*model.File, error)
}

func NewFileManager

func NewFileManager(factory gitignore.MatcherFactory) FileManager

type FileManagerImpl

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

func (*FileManagerImpl) ApplyPatch

func (fm *FileManagerImpl) ApplyPatch(ctx context.Context, fs afero.Fs, path, patch string) (*model.File, error)

func (*FileManagerImpl) CreateFile

func (fm *FileManagerImpl) CreateFile(ctx context.Context, fs afero.Fs, path, content string) (*model.File, error)

func (*FileManagerImpl) DeleteFile

func (fm *FileManagerImpl) DeleteFile(ctx context.Context, fs afero.Fs, path string) error

func (*FileManagerImpl) ListFiles

func (fm *FileManagerImpl) ListFiles(ctx context.Context, fs afero.Fs, opts ...ListFileOption) ([]*model.File, error)

func (*FileManagerImpl) ReadFile

func (fm *FileManagerImpl) ReadFile(ctx context.Context, fs afero.Fs, path string) (*model.File, error)

func (*FileManagerImpl) UpdateFile

func (fm *FileManagerImpl) UpdateFile(ctx context.Context, fs afero.Fs, path, content string) (*model.File, error)

func (*FileManagerImpl) UpdateLines

func (fm *FileManagerImpl) UpdateLines(ctx context.Context, fs afero.Fs, path string, lineDiff LineDiffChunk) (*model.File, error)

type FileNotFoundError

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

func NewFileNotFoundError

func NewFileNotFoundError(path string) *FileNotFoundError

func (FileNotFoundError) Error

func (e FileNotFoundError) Error() string

type LineDiffChunk

type LineDiffChunk struct {
	StartLine int    `json:"startLine"`
	EndLine   int    `json:"endLine"`
	Content   string `json:"content"`
}

type ListFileOption

type ListFileOption func(opts *ListFilesOptions)

func ListFilesWithContent

func ListFilesWithContent() ListFileOption

func ListFilesWithFilter

func ListFilesWithFilter(filter PatternFilter) ListFileOption

func ListFilesWithShowHidden

func ListFilesWithShowHidden() ListFileOption

type ListFilesOptions

type ListFilesOptions struct {
	WithContent bool
	ShowHidden  bool
	Filter      PatternFilter
}

type PatternFilter

type PatternFilter struct {
	Include []string
	Exclude []string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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