summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rhimport/core.go1
-rw-r--r--rhimport/fetcher.go12
2 files changed, 13 insertions, 0 deletions
diff --git a/rhimport/core.go b/rhimport/core.go
index efb6e58..e6c6624 100644
--- a/rhimport/core.go
+++ b/rhimport/core.go
@@ -70,6 +70,7 @@ const (
Auto FilePolicy = iota
Keep
Delete
+ DeleteWithDir
)
type Context struct {
diff --git a/rhimport/fetcher.go b/rhimport/fetcher.go
index 1f1e84f..dd4b6df 100644
--- a/rhimport/fetcher.go
+++ b/rhimport/fetcher.go
@@ -415,5 +415,17 @@ func FetchFile(ctx *Context) (res *Result, err error) {
} else {
err = fmt.Errorf("No fetcher for uri scheme '%s' found.", uri.Scheme)
}
+
+ switch ctx.SourceFilePolicy {
+ case Keep:
+ ctx.DeleteSourceFile = false
+ ctx.DeleteSourceDir = false
+ case DeleteWithDir:
+ ctx.DeleteSourceDir = true
+ fallthrough
+ case Delete:
+ ctx.DeleteSourceFile = true
+ }
+
return
}