Skip to content

Commit

Permalink
fix: bug where selection is always 0 index
Browse files Browse the repository at this point in the history
  • Loading branch information
laureanray committed Jun 26, 2022
1 parent b66128c commit 6e10ab2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmd/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"github.com/manifoldco/promptui"
"github.com/spf13/cobra"
"log"
"strconv"
)

var (
Expand Down Expand Up @@ -55,7 +54,8 @@ var (
Label: "Select Title",
Items: titles,
}
_, result, err := prompt.Run()

resultInt, result, err := prompt.Run()

if err != nil {
fmt.Printf("Prompt failed %v\n", err)
Expand All @@ -64,9 +64,9 @@ var (

log.Printf("You choose [%s]", result)

selection, _ := strconv.Atoi(result)
log.Println("Selection: ", resultInt, books[resultInt])

api.DownloadSelection(books[selection], libgenType)
api.DownloadSelection(books[resultInt], libgenType)
},
}
)
Expand Down

0 comments on commit 6e10ab2

Please sign in to comment.