accept several urls, fix tests, remove unused book struct

This commit is contained in:
lapwat
2023-01-18 00:52:48 +01:00
parent bf3fc65444
commit ab5e2ede07
8 changed files with 73 additions and 114 deletions

View File

@@ -132,7 +132,6 @@ var getCmd = &cobra.Command{
return nil
},
Run: func(cmd *cobra.Command, args []string) {
url := args[0]
// generate config for each level
configs := make([]*book.ScrapeConfig, len(getOpts.Selector))
@@ -162,7 +161,13 @@ var getCmd = &cobra.Command{
configs[index] = config
}
c := book.NewChapterFromURL(url, "", configs, 0, func(index int, name string) {})
// dummy root chapter to contain all subchapters
c := book.NewEmptyChapter()
for _, u := range args {
newChapter := book.NewChapterFromURL(u, "", configs, 0, func(index int, name string) {})
c.AddSubChapter(newChapter)
}
c.SetName(c.SubChapters()[0].Name())
if getOpts.Format == "md" {
filename := book.ToMarkdown(c, getOpts.output)