mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2024-10-28 04:44:11 -07:00
fix no search results found loop if no query provided
This commit is contained in:
parent
aa821e774a
commit
925b7c86e2
5
ani-cli
5
ani-cli
@ -509,14 +509,13 @@ search_anime() {
|
|||||||
process_search() {
|
process_search() {
|
||||||
search_results=$(search_anime "$@")
|
search_results=$(search_anime "$@")
|
||||||
while [ -z "$search_results" ]; do
|
while [ -z "$search_results" ]; do
|
||||||
lg "No results found for $*" 1> /dev/stderr
|
|
||||||
extended_search_results=$(extended_search "$@")
|
extended_search_results=$(extended_search "$@")
|
||||||
if [ -n "$extended_search_results" ]; then
|
if [ -n "$extended_search_results" ]; then
|
||||||
extended_search_results=$(printf '%s' "$extended_search_results" | head -n 1)
|
extended_search_results=$(printf '%s' "$extended_search_results" | head -n 1)
|
||||||
search_results=$(search_anime "$extended_search_results")
|
search_results=$(search_anime "$extended_search_results")
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
err 'No search results found'
|
err 'No search results found for '"$*"''
|
||||||
if [ "$IS_ROFI" -eq 1 ]; then
|
if [ "$IS_ROFI" -eq 1 ]; then
|
||||||
stmt="SELECT id || '. ' || anime_name FROM search_history ORDER BY search_date DESC;"
|
stmt="SELECT id || '. ' || anime_name FROM search_history ORDER BY search_date DESC;"
|
||||||
msg="Choose from list of searched anime below, or enter a unique name of an anime to search for"
|
msg="Choose from list of searched anime below, or enter a unique name of an anime to search for"
|
||||||
@ -528,6 +527,7 @@ process_search() {
|
|||||||
prompt "Search Anime"
|
prompt "Search Anime"
|
||||||
read -r query
|
read -r query
|
||||||
fi
|
fi
|
||||||
|
[ -z "$query" ] && return 1
|
||||||
search_results=$(search_anime "$query")
|
search_results=$(search_anime "$query")
|
||||||
done
|
done
|
||||||
lg "Search Results: $search_results"
|
lg "Search Results: $search_results"
|
||||||
@ -740,6 +740,7 @@ stream() {
|
|||||||
if check_db "search" "$anime_id"; then
|
if check_db "search" "$anime_id"; then
|
||||||
lg "$anime_id has been searched before"
|
lg "$anime_id has been searched before"
|
||||||
search_results=$(process_search $query) # want word splitting to account for both input cases
|
search_results=$(process_search $query) # want word splitting to account for both input cases
|
||||||
|
[ -z "$search_results" ] && die
|
||||||
if ! anime_selection "$search_results"; then
|
if ! anime_selection "$search_results"; then
|
||||||
die "No anime selection found"
|
die "No anime selection found"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user