aboutsummaryrefslogtreecommitdiff
path: root/tvsaver/saver2v1/save_creation_info.go
diff options
context:
space:
mode:
Diffstat (limited to 'tvsaver/saver2v1/save_creation_info.go')
-rw-r--r--tvsaver/saver2v1/save_creation_info.go57
1 files changed, 57 insertions, 0 deletions
diff --git a/tvsaver/saver2v1/save_creation_info.go b/tvsaver/saver2v1/save_creation_info.go
new file mode 100644
index 0000000..1592923
--- /dev/null
+++ b/tvsaver/saver2v1/save_creation_info.go
@@ -0,0 +1,57 @@
+// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
+
+package saver2v1
+
+import (
+ "fmt"
+ "io"
+
+ "github.com/spdx/tools-golang/spdx"
+)
+
+func renderCreationInfo2_1(ci *spdx.CreationInfo2_1, w io.Writer) error {
+ if ci.SPDXVersion != "" {
+ fmt.Fprintf(w, "SPDXVersion: %s\n", ci.SPDXVersion)
+ }
+ if ci.DataLicense != "" {
+ fmt.Fprintf(w, "DataLicense: %s\n", ci.DataLicense)
+ }
+ if ci.SPDXIdentifier != "" {
+ fmt.Fprintf(w, "SPDXID: %s\n", ci.SPDXIdentifier)
+ }
+ if ci.DocumentName != "" {
+ fmt.Fprintf(w, "DocumentName: %s\n", ci.DocumentName)
+ }
+ if ci.DocumentNamespace != "" {
+ fmt.Fprintf(w, "DocumentNamespace: %s\n", ci.DocumentNamespace)
+ }
+ for _, s := range ci.ExternalDocumentReferences {
+ fmt.Fprintf(w, "ExternalDocumentRef: %s\n", s)
+ }
+ if ci.LicenseListVersion != "" {
+ fmt.Fprintf(w, "LicenseListVersion: %s\n", ci.LicenseListVersion)
+ }
+ for _, s := range ci.CreatorPersons {
+ fmt.Fprintf(w, "Creator: Person: %s\n", s)
+ }
+ for _, s := range ci.CreatorOrganizations {
+ fmt.Fprintf(w, "Creator: Organization: %s\n", s)
+ }
+ for _, s := range ci.CreatorTools {
+ fmt.Fprintf(w, "Creator: Tool: %s\n", s)
+ }
+ if ci.Created != "" {
+ fmt.Fprintf(w, "Created: %s\n", ci.Created)
+ }
+ if ci.CreatorComment != "" {
+ fmt.Fprintf(w, "CreatorComment: %s\n", textify(ci.CreatorComment))
+ }
+ if ci.DocumentComment != "" {
+ fmt.Fprintf(w, "DocumentComment: %s\n", textify(ci.DocumentComment))
+ }
+
+ // add blank newline b/c end of a main section
+ fmt.Fprintf(w, "\n")
+
+ return nil
+}