fs

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertContains

func AssertContains(path, substr string) error

AssertContains asserts that a file contains the specified substring.

func AssertEmpty

func AssertEmpty(path string) error

AssertEmpty asserts that a file is empty or contains only whitespace.

func AssertExists

func AssertExists(path string) error

AssertExists asserts that a file or directory exists at the given path.

func AssertNotContains

func AssertNotContains(path, substr string) error

AssertNotContains asserts that a file does not contain the specified substring.

func AssertNotEmpty

func AssertNotEmpty(path string) error

AssertNotEmpty asserts that a file is not empty.

func AssertNotExists

func AssertNotExists(path string) error

AssertNotExists asserts that a file or directory does not exist at the given path.

func CleanPath

func CleanPath(path string) (string, error)

CleanPath returns the absolute path with symlinks resolved

func CopyFile

func CopyFile(src, dst string) error

CopyFile copies a file from src to dst

func CreateDir

func CreateDir(path string) error

CreateDir creates a directory with all parent directories

func CreateProjectStructure

func CreateProjectStructure(root string) error

CreateProjectStructure creates a basic project structure for testing

func CreateServiceFiles

func CreateServiceFiles(root string, serviceName string) error

CreateServiceFiles creates files for a test service

func EnsureDir

func EnsureDir(path string) error

EnsureDir ensures a directory exists, creating it if necessary

func Exists

func Exists(path string) bool

Exists checks if a path exists

func IsDir

func IsDir(path string) bool

IsDir checks if a path is a directory

func IsFile

func IsFile(path string) bool

IsFile checks if a path is a regular file

func ListDirs

func ListDirs(dir string) ([]string, error)

ListDirs returns all subdirectories in a directory (non-recursive)

func ListFiles

func ListFiles(dir string) ([]string, error)

ListFiles returns all files in a directory (non-recursive)

func ReadString

func ReadString(path string) (string, error)

ReadString reads a file and returns its content as a string

func RemoveIfExists

func RemoveIfExists(path string) error

RemoveIfExists removes a file or directory if it exists

func WriteBasicGroveConfig

func WriteBasicGroveConfig(dir string) error

WriteBasicGroveConfig writes a minimal, valid grove.yml for testing a project.

func WriteFile

func WriteFile(path string, content []byte) error

WriteFile writes content to a file, creating parent directories as needed

func WriteGlobalGroveConfig

func WriteGlobalGroveConfig(homeDir string, searchPaths map[string]config.SearchPathConfig) error

WriteGlobalGroveConfig writes a global grove.yml with search paths into a sandboxed home directory. This is useful for testing workspace discovery scenarios.

func WriteGroveConfig

func WriteGroveConfig(dir string, cfg *config.Config) error

WriteGroveConfig writes a grove.yml file to the specified directory

func WriteString

func WriteString(path string, content string) error

WriteString writes a string to a file

Types

type TempDirManager

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

TempDirManager manages temporary directories for tests

func NewTempDirManager

func NewTempDirManager(prefix string) (*TempDirManager, error)

NewTempDirManager creates a new temporary directory manager

func NewTempDirManagerForExisting

func NewTempDirManagerForExisting(path string) (*TempDirManager, error)

NewTempDirManagerForExisting creates a new TempDirManager for a path that already exists. The manager will not delete this path on Cleanup since it was created by an external process (the orchestrator).

func (*TempDirManager) BaseDir

func (m *TempDirManager) BaseDir() string

BaseDir returns the root temporary directory

func (*TempDirManager) Cleanup

func (m *TempDirManager) Cleanup() error

Cleanup removes all created directories

func (*TempDirManager) CreateDir

func (m *TempDirManager) CreateDir(name string) (string, error)

CreateDir creates a subdirectory within the temp space

Jump to

Keyboard shortcuts

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