Skip to content

Commit

Permalink
Display warning when no manga are found (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
browningluke committed Nov 13, 2024
1 parent e1ff499 commit c3e6e93
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/mangathr/download/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ func (o *downloadOpts) run(cfg *config.Config) {

// Search and select manga
titles, err := scraper.Search(o.Query)

// Exit if no manga are found
if len(titles) == 0 {
ui.PrintlnColor(ui.Yellow, "No manga found with specified query. Exiting...")
return
}

logging.ExitIfError(err)

selection, uierr := ui.SingleCheckboxes("Select Manga:", titles)
Expand Down
6 changes: 6 additions & 0 deletions cmd/mangathr/register/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ func findManga(args *registerOpts) (options, bool) {
return options{}, true
}

// Exit if no manga are found
if len(titles) == 0 {
ui.PrintlnColor(ui.Yellow, "No manga found with specified query. Exiting...")
return options{}, true
}

selection := titles[0]
if len(titles) > 1 {
var uierr error
Expand Down

0 comments on commit c3e6e93

Please sign in to comment.