filelist/FileList: add Import method

This commit is contained in:
Clayton Craft
2023-02-18 02:08:18 -08:00
parent 662f559286
commit e5002f5750

View File

@@ -37,6 +37,14 @@ func (f *FileList) Get(src string) (string, bool) {
return dest, found return dest, found
} }
// Import copies in the contents of src. If a source path already exists when
// importing, then the destination path is updated with the new value.
func (f *FileList) Import(src *FileList) {
for i := range src.IterItems() {
f.Add(i.Source, i.Dest)
}
}
// iterate through the list and and send each one as a new File over the // iterate through the list and and send each one as a new File over the
// returned channel // returned channel
func (f *FileList) IterItems() <-chan File { func (f *FileList) IterItems() <-chan File {