@@ -51,10 +51,7 @@ func marks(bs *book.BookShelves, shelfName string, collectionName string, format
5151 }
5252 switch format {
5353 case "toml" :
54- wrapped := struct {
55- Marks []catalog.SearchResult `toml:"marks"`
56- }{deleted }
57- return book .PrintCatalog (wrapped , format )
54+ return book .PrintCatalog (catalog.SearchResultList {Marks : deleted }, format )
5855 case "json" :
5956 return book .PrintCatalog (deleted , format )
6057 default :
@@ -111,7 +108,7 @@ func editMark(bs *book.BookShelves, id, title, tags, url string, config *book.Co
111108 return err
112109 }
113110 if err := bs .VerifyUniqueURL (book .GenerateID (url ), target ); err != nil {
114- return err
111+ return fmt . Errorf ( "verify unique url: %w" , err )
115112 }
116113 }
117114
@@ -142,11 +139,7 @@ func searchMarks(query string, tags string, shelfName string, collectionName str
142139 case "json" :
143140 return book .PrintCatalog (results , format )
144141 case "toml" :
145- // TOML requires a top-level map or struct, so wrap the slice.
146- wrapped := struct {
147- Marks []catalog.SearchResult `toml:"marks"`
148- }{results }
149- return book .PrintCatalog (wrapped , format )
142+ return book .PrintCatalog (catalog.SearchResultList {Marks : results }, format )
150143 default :
151144 for _ , r := range results {
152145 fmt .Printf ("%s %s\n " , r .Title , r .URL )
@@ -163,7 +156,7 @@ func addMark(bs *book.BookShelves, URL string, tags string, shelfName string, co
163156
164157 // Ensure URL hash not in bookshelves
165158 if err := bs .VerifyUniqueURL (mark .ID , nil ); err != nil {
166- return err
159+ return fmt . Errorf ( "verify unique url: %w" , err )
167160 }
168161
169162 // Use provided title or fetch from URL
@@ -172,7 +165,7 @@ func addMark(bs *book.BookShelves, URL string, tags string, shelfName string, co
172165 fetchedTitle , err := web .LoadWebsite (mark .URL )
173166 if err != nil {
174167 if ! errors .Is (err , web .ErrTitleUnavailable ) {
175- return err
168+ return fmt . Errorf ( "load website: %w" , err )
176169 }
177170 fetched .Unavailable = true
178171 } else {
0 commit comments