aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--skate/zippy.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/skate/zippy.go b/skate/zippy.go
index 65155e8..8e629bf 100644
--- a/skate/zippy.go
+++ b/skate/zippy.go
@@ -186,10 +186,11 @@ func ZippyVerifyRefsOpenLibraryTable(olr, refs io.Reader, w io.Writer) error {
// compare against titles from open library.
re.Title = re.ContainerName
result := Verify(pivot, re)
- fmt.Printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\n",
+ fmt.Printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",
result.Status.Short(),
result.Reason.Short(),
pivot.Extra.OpenLibrary.WorkID,
+ FindByPrefix(pivot.Extra.OpenLibrary.SourceRecords, "ia:"),
re.Ident,
CutSep(g.G0[0], "\t", 1),
pivot.Title,
@@ -218,6 +219,16 @@ func CutSep(line, sep string, column int) string {
}
}
+// FindByPrefix return the first element for a slice of strings, which matches a prefix.
+func FindByPrefix(ss []string, prefix string) string {
+ for _, s := range ss {
+ if strings.HasPrefix(s, prefix) {
+ return s
+ }
+ }
+ return ""
+}
+
// makeKeyFunc creates a function that can be used as keyFunc, selecting a
// column from fields separated by sep; column is 1-indexed.
func makeKeyFunc(sep string, column int) func(string) (string, error) {