added preliminary functionality to open a range of search results

This commit is contained in:
christian Sillaber 2016-08-18 17:19:53 +02:00
parent 5ac703d6ae
commit 536dc759ee

13
buku
View File

@ -1237,9 +1237,9 @@ def prompt(results, noninteractive=False, delete=False):
while True: while True:
try: try:
nav = input('Result number to open: ') nav = input('Result number or range (x-y) to open: ')
if not nav: if not nav:
nav = input('Result number to open: ') nav = input('Result number or range (x-y) to open: ')
if not nav: if not nav:
# Quit on double enter # Quit on double enter
break break
@ -1257,6 +1257,15 @@ def prompt(results, noninteractive=False, delete=False):
except Exception as e: except Exception as e:
_, _, linenumber, func, _, _ = inspect.stack()[0] _, _, linenumber, func, _, _ = inspect.stack()[0]
logger.error('%s(), ln %d: %s', func, linenumber, e) logger.error('%s(), ln %d: %s', func, linenumber, e)
elif "-" in nav and is_int(nav.split("-")[0]) and is_int(nav.split("-")[1]):
lower = int(nav.split("-")[0])
upper = int(nav.split("-")[1])
for index in range(lower-1,upper-1):
try:
browser_open(unquote(results[index][1]))
except Exception as e:
_, _, linenumber, func, _, _ = inspect.stack()[0]
logger.error('%s(), ln %d: %s', func, linenumber, e)
else: else:
break break