mirror of
https://github.com/anchore/syft.git
synced 2026-11-01 06:56:40 +01:00
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:
co-authored by
Keith Zantow
parent
9744f4c009
commit
4ab9f393fc
@@ -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,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user