*.go: fetching the books with progress bar
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
cbb7bf1d6c
commit
ebfd8ac60d
2 changed files with 66 additions and 9 deletions
19
cmd/root.go
19
cmd/root.go
|
@ -47,13 +47,16 @@ to quickly create a Cobra application.`,
|
|||
// Uncomment the following line if your bare application
|
||||
// has an action associated with it:
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
b, err := goldenaudiobooks.BookScrape("https://goldenaudiobooks.com/the-water-dancer-oprahs-book-club-audiobook/")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
log.Debug(b)
|
||||
if err = goldenaudiobooks.BookFetccher(b, ".", true); err != nil {
|
||||
log.Fatal(err)
|
||||
for _, arg := range args {
|
||||
// "https://goldenaudiobooks.com/the-water-dancer-oprahs-book-club-audiobook/"
|
||||
b, err := goldenaudiobooks.BookScrape(arg)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
log.Debug(b)
|
||||
if err = goldenaudiobooks.BookFetcher(b, ".", viper.GetBool("create-local")); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@ -79,6 +82,8 @@ func init() {
|
|||
// Cobra also supports local flags, which will only run
|
||||
// when this action is called directly.
|
||||
rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
||||
rootCmd.Flags().StringP("dest", "d", ".", "destination base for fetched books")
|
||||
rootCmd.Flags().BoolP("create-local", "C", false, "create files in local directory")
|
||||
}
|
||||
|
||||
// initConfig reads in config file and ENV variables if set.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue