mirror of
https://github.com/anchore/syft.git
synced 2026-11-01 15:06:36 +01:00
510 - SBOM attestation stdout (#785)
add syft attest command to produce an attestation as application/vnd.in-toto+json to standard out using on disk PKI Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
This commit is contained in:
@@ -29,7 +29,7 @@ var AllSchemes = []Scheme{
|
||||
FileScheme,
|
||||
}
|
||||
|
||||
func detectScheme(fs afero.Fs, imageDetector sourceDetector, userInput string) (Scheme, image.Source, string, error) {
|
||||
func DetectScheme(fs afero.Fs, imageDetector sourceDetector, userInput string) (Scheme, image.Source, string, error) {
|
||||
switch {
|
||||
case strings.HasPrefix(userInput, "dir:"):
|
||||
dirLocation, err := homedir.Expand(strings.TrimPrefix(userInput, "dir:"))
|
||||
|
||||
@@ -287,7 +287,7 @@ func TestDetectScheme(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
actualScheme, actualSource, actualLocation, err := detectScheme(fs, imageDetector, test.userInput)
|
||||
actualScheme, actualSource, actualLocation, err := DetectScheme(fs, imageDetector, test.userInput)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected err : %+v", err)
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ type sourceDetector func(string) (image.Source, string, error)
|
||||
// New produces a Source based on userInput like dir: or image:tag
|
||||
func New(userInput string, registryOptions *image.RegistryOptions, exclusions []string) (*Source, func(), error) {
|
||||
fs := afero.NewOsFs()
|
||||
parsedScheme, imageSource, location, err := detectScheme(fs, image.DetectSource, userInput)
|
||||
parsedScheme, imageSource, location, err := DetectScheme(fs, image.DetectSource, userInput)
|
||||
if err != nil {
|
||||
return &Source{}, func() {}, fmt.Errorf("unable to parse input=%q: %w", userInput, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user