fs

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GitignoreMarkerStart is the start marker for thts-managed gitignore patterns.
	GitignoreMarkerStart = "# thts-agent-start"
	// GitignoreMarkerEnd is the end marker for thts-managed gitignore patterns.
	GitignoreMarkerEnd = "# thts-agent-end"
)

Gitignore marker constants.

Variables

This section is empty.

Functions

func AddGitignoreMarkerBlock added in v0.2.0

func AddGitignoreMarkerBlock(repoPath string, patterns []string) ([]string, error)

AddGitignoreMarkerBlock adds patterns between markers in the gitignore file. If a marker block already exists, it updates the patterns within it. Returns the list of patterns that were added.

func AddToGitignore

func AddToGitignore(repoPath, pattern string, location config.ComponentMode) (bool, error)

AddToGitignore adds a pattern to the appropriate gitignore file. Returns true if the pattern was added, false if it already existed or was disabled.

func CreateSymlink(target, linkPath string) error

CreateSymlink creates a symbolic link at linkPath pointing to target. If linkPath already exists, it returns an error.

func EnsureDir

func EnsureDir(path string) error

EnsureDir creates a directory and all parent directories if they don't exist.

func Exists

func Exists(path string) bool

Exists returns true if the path exists (follows symlinks).

func ExistsNoFollow

func ExistsNoFollow(path string) bool

ExistsNoFollow returns true if the path exists (does not follow symlinks).

func GetGitignoreMarkerPatterns added in v0.2.0

func GetGitignoreMarkerPatterns(repoPath string) []string

GetGitignoreMarkerPatterns returns the patterns in the marker block.

func HasGitignoreMarkerBlock added in v0.2.0

func HasGitignoreMarkerBlock(repoPath string) bool

HasGitignoreMarkerBlock checks if the gitignore file has a thts marker block.

func IsDir

func IsDir(path string) bool

IsDir returns true if the path is a directory (follows symlinks).

func IsDirNoFollow

func IsDirNoFollow(path string) bool

IsDirNoFollow returns true if the path is a directory (does not follow symlinks).

func IsSymlink(path string) bool

IsSymlink returns true if the path is a symbolic link.

func RemoveAll

func RemoveAll(path string) error

RemoveAll removes path and any children it contains. It handles permission issues with special directories like searchable/.

func RemoveFromGitignore

func RemoveFromGitignore(repoPath, pattern string, location config.ComponentMode) (bool, error)

RemoveFromGitignore removes a pattern from the gitignore file. Returns true if the pattern was removed.

func RemoveGitignoreMarkerBlock added in v0.2.0

func RemoveGitignoreMarkerBlock(repoPath string) ([]string, error)

RemoveGitignoreMarkerBlock removes the marker block from the gitignore file. Returns the patterns that were removed.

func ResolveSymlink(path string) (string, error)

ResolveSymlink resolves a symbolic link to its final target (like realpath).

func SymlinkTarget

func SymlinkTarget(path string) (string, error)

SymlinkTarget returns the target of a symbolic link.

Types

This section is empty.

Jump to

Keyboard shortcuts

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