core

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFailedToReadDirectory = errors.New("failed to read directory")

Functions

func ClearFolder

func ClearFolder(t *testing.T, cfg RunTime, fs FileSystem) error

clearFolder removes all subfolders within the specified directory, excluding a specific subfolder. It takes a FolderConfig struct as input containing the paths to relevant directories.

func RestoreVarsFile

func RestoreVarsFile(t *testing.T, cfg RunTime, fs FileSystem) error

RestoreVarsFile restores the original content.

func UpdateVarsFile

func UpdateVarsFile(t *testing.T, cfg RunTime, fs FileSystem) ([]byte, error)

Types

type FileSystem

type FileSystem interface {
	ReadDir(dirname string) ([]os.DirEntry, error)
	RemoveAll(path string) error
	ReadFile(path string) ([]byte, error)
	WriteFile(filename string, data []byte, perm fs.FileMode) error
}

FileSystem interface abstracts file system operations.

type FolderPaths

type FolderPaths struct {
	HomeDir       string
	TgDownloadDir string
	TfPluginDir   string
	TerragruntDir string
}

type OsFileSystem

type OsFileSystem struct{}

OsFileSystem is a real implementation of FileSystem.

func (OsFileSystem) ReadDir

func (OsFileSystem) ReadDir(dirname string) ([]os.DirEntry, error)

func (OsFileSystem) ReadFile

func (OsFileSystem) ReadFile(path string) ([]byte, error)

func (OsFileSystem) RemoveAll

func (OsFileSystem) RemoveAll(path string) error

func (OsFileSystem) WriteFile

func (OsFileSystem) WriteFile(filename string, data []byte, perm fs.FileMode) error

type RunTime

type RunTime struct {
	Paths         FolderPaths
	Content       string
	VarsFile      string
	IsPluginCache bool
	IsDebug       bool
	Pause         time.Duration
}

func NewConfig

func NewConfig() RunTime

NewFolderConfig creates a new instance of FolderConfig with default values.

Jump to

Keyboard shortcuts

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