feat: CLI flag for directory base (#1867)

Signed-off-by: Avi Deitcher <avi@deitcher.net>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Co-authored-by: Keith Zantow <kzantow@gmail.com>
This commit is contained in:
Avi Deitcher
2023-07-10 13:36:41 -04:00
committed by GitHub
co-authored by Keith Zantow
parent 9744f4c009
commit 4ab9f393fc
6 changed files with 18 additions and 1 deletions
+6 -1
View File
@@ -87,6 +87,7 @@ type DetectionSourceConfig struct {
Platform *image.Platform
Exclude ExcludeConfig
DigestAlgorithms []crypto.Hash
BasePath string
}
func DefaultDetectionSourceConfig() DetectionSourceConfig {
@@ -117,10 +118,14 @@ func (d Detection) NewSource(cfg DetectionSourceConfig) (Source, error) {
},
)
case directoryType:
base := cfg.BasePath
if base == "" {
base = d.location
}
src, err = NewFromDirectory(
DirectoryConfig{
Path: d.location,
Base: d.location,
Base: base,
Exclude: cfg.Exclude,
Alias: cfg.Alias,
},