hookscripts: glob hook directories
This commit is contained in:
@@ -51,7 +51,7 @@ func (f *FileList) Import(src *FileList) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *FileList) AddGlobbed(src string, dest string) (error) {
|
func (f *FileList) AddGlobbed(src string, dest string) error {
|
||||||
fFiles, err := misc.GetFiles([]string{src}, true)
|
fFiles, err := misc.GetFiles([]string{src}, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to add %q: %w", src, err)
|
return fmt.Errorf("unable to add %q: %w", src, err)
|
||||||
|
@@ -35,8 +35,13 @@ func (h *HookScripts) List() (*filelist.FileList, error) {
|
|||||||
}
|
}
|
||||||
for _, file := range fileInfo {
|
for _, file := range fileInfo {
|
||||||
path := filepath.Join(h.scriptsDir, file.Name())
|
path := filepath.Join(h.scriptsDir, file.Name())
|
||||||
|
if file.IsDir() {
|
||||||
|
log.Printf("-- Including dir %s\n", path)
|
||||||
|
files.AddGlobbed(filepath.Join(path, "*"), filepath.Join(h.destPath, file.Name()))
|
||||||
|
} else {
|
||||||
log.Printf("-- Including script: %s\n", path)
|
log.Printf("-- Including script: %s\n", path)
|
||||||
files.Add(path, filepath.Join(h.destPath, file.Name()))
|
files.Add(path, filepath.Join(h.destPath, file.Name()))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return files, nil
|
return files, nil
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user