Fix: confirmation not show up on batch update

This commit is contained in:
Radhi Fadlillah 2019-06-10 00:06:51 +07:00
parent 96d4a4cff3
commit 0efe7eae82

View file

@ -76,21 +76,6 @@ func updateHandler(cmd *cobra.Command, args []string) {
return
}
// Check if user really want to batch update archive
if len(ids) > 3 && !noArchival && !skipConfirm {
fmt.Println("This update process will also generate the offline archive for the selected bookmarks.")
fmt.Println("This might take a long time and a lot of your network bandwith.")
confirmUpdate := ""
fmt.Printf("Continue update and archival process for %d bookmark(s)? (y/N): ", len(ids))
fmt.Scanln(&confirmUpdate)
if confirmUpdate != "y" {
fmt.Println("No bookmarks updated")
return
}
}
// Clean up new parameter from flags
title = normalizeSpace(title)
excerpt = normalizeSpace(excerpt)
@ -130,6 +115,22 @@ func updateHandler(cmd *cobra.Command, args []string) {
return
}
// Check if user really want to batch update archive
if nBook := len(bookmarks); nBook > 5 && !offline && !noArchival && !skipConfirm {
fmt.Println()
fmt.Printf("This update will also generate offline archive for %d bookmark(s).\n", nBook)
fmt.Println("This might take a long time and uses lot of your network bandwith.")
confirmUpdate := ""
fmt.Printf("Continue update and archival process ? (y/N): ")
fmt.Scanln(&confirmUpdate)
if confirmUpdate != "y" {
fmt.Println("No bookmarks updated")
return
}
}
// If it's not offline mode, fetch data from internet
idWithProblems := []int{}