fix: -o output option to include formats (#1102)

This commit is contained in:
cpendery 2022-07-15 09:55:15 -04:00 committed by GitHub
parent 64b4852c2a
commit 922663c987
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -53,7 +53,7 @@ func parseOutputs(outputs []string, defaultFile, templateFilePath string) (out [
format := syft.FormatByName(name)
if format == nil {
errs = multierror.Append(errs, fmt.Errorf("bad output format: '%s'", name))
errs = multierror.Append(errs, fmt.Errorf(`unsupported output format "%s", supported formats are: %+v`, name, FormatAliases(syft.FormatIDs()...)))
continue
}

View File

@ -22,7 +22,7 @@ func TestIsSupportedFormat(t *testing.T) {
{
outputs: []string{"unknown"},
wantErr: func(t assert.TestingT, err error, bla ...interface{}) bool {
return assert.ErrorContains(t, err, "bad output format: 'unknown'")
return assert.ErrorContains(t, err, `unsupported output format "unknown", supported formats are: [`)
},
},
}