Documentation
¶
Index ¶
- func CopyDirectory(src string, dest string, ignorePaths []string) error
- func CustomTxtFuncMap(tmpl *template.Template) template.FuncMap
- func DeleteIgnoredFiles(directoryPath string, ignorePaths []string) error
- func GetAllDirectoryPaths(directoryPath string, ignorePaths []string) ([]string, error)
- func GetAllFilePaths(directoryPath string, ignorePaths []string) ([]string, error)
- func ShouldIgnorePath(baseDirectory string, path string, ignorePaths []string) (bool, error)
- func WatchDirectory(watcher *fsnotify.Watcher, directoryPath string, ignorePaths []string, ...) error
- type TemplateFiller
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyDirectory ¶
CopyDirectory copies a directory recursively with options to specify directories and files to ignore.
func CustomTxtFuncMap ¶
TxtCustomFuncMap returns a FuncMap with the custom functions used in the templates. You can implement your own custom functions inside of this func.
func DeleteIgnoredFiles ¶
DeleteIgnoredFiles recursively walks through a directory and its subdirectories specified by 'directoryPath'. It deletes files and directories that match any of the patterns in 'ignorePaths'. Additionally, it deletes files and directories starting with "_" (Ignore Prefix), which are files that should be processed by Cloney but not copied when the template is cloned.
func GetAllDirectoryPaths ¶
GetAllDirectoryPaths returns a list of all directory paths within a directory and its subdirectories, with options to specify directories and files to ignore.
func GetAllFilePaths ¶
GetAllFilePaths returns a list of all file paths within a directory and its subdirectories, with options to specify directories and files to ignore.
func ShouldIgnorePath ¶
ShouldIgnorePath determines whether a given file or directory path should be ignored based on a list of patterns within a specified base directory. It returns true if the path should be ignored according to any of the provided patterns, and false otherwise.
func WatchDirectory ¶
func WatchDirectory(watcher *fsnotify.Watcher, directoryPath string, ignorePaths []string, onChange func()) error
WatchDirectory monitors a directory and its subdirectories for changes, including create, write, remove, rename, and chmod events. It receives a function that is called when any of these events are detected.
Parameters:
watcher: An initialized fsnotify.Watcher. directoryPath: The path of the directory to watch. ignorePaths: An optional list of file paths to ignore during monitoring. onChange: A callback function to execute when any valid event is detected.
Returns an error if any issues occur during setup or monitoring.
Types ¶
type TemplateFiller ¶
type TemplateFiller struct {
// Variables contains the variables to be injected into the template.
Variables map[string]interface{}
}
TemplateFiller is a struct used for populating Go templates with variables.
func NewTemplateFiller ¶
func NewTemplateFiller(variablesMap map[string]interface{}) *TemplateFiller
NewTemplateFiller creates a new TemplateFiller instance initialized with the provided variables.
func (*TemplateFiller) FillDirectory ¶
func (t *TemplateFiller) FillDirectory(src string, ignorePaths []string, outputInTerminal bool) error
FillDirectory processes template files in a source directory, replacing placeholders with variables.