-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: separate format packages and update list command formats (#32)
--------- Signed-off-by: Christopher Phillips <[email protected]>
- Loading branch information
Showing
17 changed files
with
362 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package internal | ||
|
||
type ReportOptions struct { | ||
Format Format | ||
ShowPackages bool | ||
CheckNonSPDX bool | ||
OsiApproved bool | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package internal | ||
|
||
import "github.com/google/uuid" | ||
|
||
type Format string | ||
|
||
const ( | ||
JSON Format = "json" | ||
Table Format = "table" | ||
) | ||
|
||
var ValidFormats = []Format{JSON, Table} | ||
|
||
// ValidateFormat returns a valid format or the default format if the given format is invalid | ||
func ValidateFormat(f Format) Format { | ||
switch f { | ||
case "json": | ||
return JSON | ||
case "table": | ||
return Table | ||
default: | ||
return Table | ||
} | ||
} | ||
|
||
func NewReportID() string { | ||
return uuid.Must(uuid.NewRandom()).String() | ||
} |
Oops, something went wrong.