From e5002f575070dbaa8b47366cb2354f41077dbf8e Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Sat, 18 Feb 2023 02:08:18 -0800 Subject: [PATCH] filelist/FileList: add Import method --- internal/filelist/filelist.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/filelist/filelist.go b/internal/filelist/filelist.go index 997181a..bd06960 100644 --- a/internal/filelist/filelist.go +++ b/internal/filelist/filelist.go @@ -37,6 +37,14 @@ func (f *FileList) Get(src string) (string, bool) { 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 // returned channel func (f *FileList) IterItems() <-chan File {